Hiding the comments of the xhtml page
Sometimes when developers go to a website they search through the generated code of the page. Sometimes it is possible to see comments that a developer left in the page. For example, if you access the site http://uaihebert.com you may find comments like: “<!– Google Analytics Tracking by Google Analyticator 6.2: http://ronaldheft.com/code/analyticator/ –>”, “<!– ending category –>”, “<!– close expanded month –>”, etc.
With JSF there is an option to hide this kind of comment from the user, the comments will not be sent to the user page. To see this configuration in action add the following code in the “index.xhtml” page:
<!-- Testing -->
Start the server and access the page; check the source code of the page and you will see the commented code there.
To hide the comments found in page add the code below in the web.xml file and the comment will be hidden from the user:
<context-param> <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name> <param-value>true</param-value> </context-param>