Comments in JSF

Other topics

Remarks:

You can find more information at Oracle documentation:

Use tag <ui:remove>

We need to use tag <ui:remove> and </ui:remove> between any JSF code that we want to comment it.

<ui:remove>
    <h:outputLabel value="Yeah, I'm really commented" />
</ui:remove>

Of course you need add this xmlns to your header html tag. Check this minimal full example:

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets">
    
    <ui:remove>
        <h:outputLabel value="Yeah, I'm really commented" />
    </ui:remove>
    
</html>

Configure facelets.SKIP_COMMENTS

You must to add to web.xml a configuration tag like this:

<context-param>
    <param-name>facelets.SKIP_COMMENTS</param-name>
    <param-value>true</param-value>
</context-param>

Now you can use normal HTML comments tag <!-- and -->

<!--
    <h:outputLabel value="Yeah, I'm really commented" />
-->

Previuosly full example with facelets.SKIP_COMMENTS configured in web.xml will be:

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets">
    
    <!--
        <h:outputLabel value="Yeah, I'm really commented" />
    -->
    
</html>

Syntax:

  • <ui:remove> JSF code that you want to comment </ui:remove>

Contributors

Topic Id: 8164

Example Ids: 26256,26257

This site is not affiliated with any of the contributors.