0

We have a commandline application, which generates HTML files. So far we use Freemarker. I'd like to use Wicket in a similar fashion: Give it a map of arguments, perhaps models (which are Java obects), and let Wicket render the HTML file.

What would be the way to do this? Is it supported? I mean, is there a public API for that, rather than using some internal API that is a subject to change in minor releases?

Ondra Žižka
  • 43,948
  • 41
  • 217
  • 277

1 Answers1

3

See org.apache.wicket.core.util.string.ComponentRenderer#renderPage(PageProvider).

Another way is to use WicketTester#startPage() + WicketTester#getLastRenderedPageAsString().

martin-g
  • 17,243
  • 2
  • 23
  • 35
  • Do you have any example? – TOUDIdel Jun 13 '16 at 14:04
  • 1
    http://examples7x.wicket.apache.org/mailtemplate/ uses ComponentRenderer to render a Page and a Panel. Follow the "Source code" link. Or browse the code in the Git repo: https://github.com/apache/wicket/blob/7973959f169a1c44c1de18a6acde21c8b926d64c/wicket-examples/src/main/java/org/apache/wicket/examples/asemail/MailTemplate.java – martin-g Jun 13 '16 at 14:50