11

With the JSF/Seam/RichFaces stack, is there a way to mark up comments (on XHTML pages) so that they will not be included in the HTML output? I.e., something like JSP's <%-- comments --%>, as opposed to normal <!-- comments -->.

I heard that facelets.SKIP_COMMENTS context-param migth do this for normal HTML comments, but is there any other option? (After all, there might be some comments that you want included in the page output and some that you don't.)

Jonik
  • 80,077
  • 70
  • 264
  • 372

2 Answers2

16

Found an answer in a thread on the JSF for nonbelievers forum of IBM developerWorks:

<ui:remove><!--
    <tags you want to remove/>
--></ui:remove>

See the official Facelets documentation of ui:remove for more information.

acdcjunior
  • 132,397
  • 37
  • 331
  • 304
eh.
  • 287
  • 2
  • 9
  • Thanks, this works! (For the record, if using IntelliJ IDEA, one could as well leave out the `` comments inside ``, as IDEA won't show the contents as commented.) – Jonik Apr 27 '10 at 08:15
  • Link now seems to be: https://facelets.java.net/nonav/docs/dev/docbook.html#template-remove (no more dev in the URL?) – udog Nov 16 '14 at 23:12
6

Use the facelets.SKIP_COMMENTS context-param. You won't need comments in the generated pages. They are not meant to be human-readable anyway.

Bozho
  • 588,226
  • 146
  • 1,060
  • 1,140
  • 3
    "They are not meant to be human-readable anyway" <-- reason #293 why we front end dev's hate JSF pages. ;) – DA. Aug 26 '11 at 15:32