Comments in JSF2 Facelets

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:


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.