But to expose those comments in your final production-deployed web app is not a good thing. It will increase the exposure of the code, and may cause some network performance issues.
In JSF 2, you can remove ALL HTML comments, by adding this to your web.xml:
<context-param> <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name> <param-value>true</param-value> </context-param>
And, of course, you can remove them one by one by using
If you’re using JSP, one thing you can do (and this is the approach I prefer) is to use scriptlet comments. According to the Java Server Pages code conventions, you can use scripting language comments:
This is following some JSDoc conventions. It might help you since some IDEs can understand that. And, of course, following conventions is always good.
Futhermore, the article exposes what it calls pure JSP comment:
Well, I don’t use this last approach. For HTML comments inside JSP files, I use standard inline scriptlet comment:
<%-- this is a comment. the user will not see it --%>
What about comments inside .js files?
Lets put it all together:
|jsp/jstl||inline scriptlet||Scripting language comments||compression tool|
|facelets||context param in web.xml||ui:remove||compression tool|