9

JSPs support the <%-- comment --%> syntax for comments, which is a way to comment markup code such that it doesn't get included in the emitted HTML.

Is there a way to do this in Wicket?

Jonik
  • 80,077
  • 70
  • 264
  • 372
George Armhold
  • 30,824
  • 50
  • 153
  • 232
  • 1
    http://stackoverflow.com/questions/3933921/generating-commented-out-content-with-wicket – slandau Jul 19 '11 at 15:31
  • I always thought normal `` comments aren't copied in the generated markup. – biziclop Jul 19 '11 at 17:47
  • 2
    @slandau: that old question of mine is kind of the *opposite* of this one: it's about how to include Java-generated commented-out content in Wicket's HTML output. – Jonik Jul 19 '11 at 20:43
  • @biziclop- comments are always passed through the generated markup. They don't render in the browser, but clever users can certainly see them with "view source". JSPs are able to get away with the <%-- --%> syntax because it's extra-lingual, as far as HTML is concerned. – George Armhold Jul 20 '11 at 19:22

2 Answers2

17

<wicket:remove> is your friend. Wicket will remove this from output.

See here https://cwiki.apache.org/confluence/display/WICKET/Wicket's+XHTML+tags#Wicket%27sXHTMLtags-Elementwicket%3Aremove

razlebe
  • 7,134
  • 6
  • 42
  • 57
Hajo Thelen
  • 1,095
  • 1
  • 11
  • 16
  • Just to add to your answer Hajo, I would use HTML comments inside the tags. – Marcelo Jul 19 '11 at 15:47
  • Nice. I guess Wicket's reasoning for not introducing another syntax (like JSP does) is that they want the files to be valid HTML, so that designers etc. can open the files directly in a browser, without the app running. – George Armhold Aug 13 '11 at 12:52
8

there's

Application#getMarkupSettings().setStripComments(true) 

which will remove

<!-- comment --> 

from your markup

Peter Ertl
  • 81
  • 1