• 1 reply
  • Latest Post - ‏2009-08-26T15:54:24Z by SystemAdmin
289 Posts

Pinned topic jsf comments

‏2006-11-16T01:57:08Z |
Hi! i am newie with jsf and i have a problems with comments. I see that JSF doesn´t consider mi commetns, por example.

<h:selectOneRadio value="#{miBean.elemento}">
<f:selectItem itemValue="0" itemLabel="cats" />
<f:selectItem itemValue="1" itemLabel="dogs" />
<f:selectItem itemValue="2" itemLabel="birds" />
<f:selectItem itemValue="3" itemLabel="hamsters" />
<!-- <f:verbatim>hello!</f:verbatim>-->
<!-- <f:selectItem itemValue="3" itemLabel="hamsters" />-->
<!-- <f:selectItem itemValue="3" itemLabel="hamsters" />-->
<f:selectItem itemValue="4" itemLabel="lizards" />
<f:selectItem itemValue="5" itemLabel="snakes" />

When this is rendered, hello is printed. Also, if i write this (something that is wrong ) i have an error.
<!-- <f:selectItem itemValue="3" itemLabellllll="hamsters" />-->
So, mi question is, how can i then write real comments in jsf ? I want to write wathever in a coment and i don`t want it to be validated neither printed....

thanks and sorry for mi english

Updated on 2009-08-26T15:54:24Z at 2009-08-26T15:54:24Z by SystemAdmin
  • SystemAdmin
    289 Posts

    Re: jsf comments

    You can use <ui:remove> along with HTML/XML comments as follows:
    <ui:remove><!-- <tags you want to remove/> --!></ui:remove>

    This way you get the behavior you want, while still allowing your editor to highlight this section of code as commented.

    Alternatively, you can add the following to your web.xml file: (thanks to Tim Desjardins)
    <context-param> <param-name>facelets.SKIP_COMMENTS</param-name> <param-value>true</param-value> </context-param>

    The second way can interfere with other things (such as Google AdSense script), so I prefer the first method.