Facelets/JSF2 pages are well formatted XML (XHTML) documents and not JSP pages, so we cannot use the classic <%- – … – -%> JSP comment format.
Instead, we have to employ use the XML comment syntax <!- – … – ->. The downside is that these comments are sent to the client browser as classic HTML comments.
To avoid this, we have to command the Facelet engine to not include comments in the output stream. We can do this by adding the following code to the web.xml file of our JSF2 web application:
<context-param> <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name> <param-value>true</param-value> </context-param>