I would like to remove all HTML comments from my facelets before delivering to end users. Does any standard approach exist?
+7
A:
There are actually two ways:
To remove ALL comments, add this to
web.xml
:<context-param> <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name> <param-value>true</param-value> </context-param>
or when you're still on JSF 1.2 which doesn't use Facelets as default view technology yet:
<context-param> <param-name>facelets.SKIP_COMMENTS</param-name> <param-value>true</param-value> </context-param>
To remove specific comments only, use
<ui:remove>
.<ui:remove><!-- This is a HTML comment. --></ui:remove>
BalusC
2010-08-02 13:22:55
Didn't know that, and i've been working with JSF/Facelets for 1 year.
f1sh
2010-08-02 15:26:00
@f1sh: You're welcome. You learn something new here daily :)
BalusC
2010-08-02 15:30:29