I need a second opinion about using Wickets template capabilities to send
HTML emails from a Wicket web application.

Situation:
I create an instance of a WebPage which must rendered to a String. This
String is then passed to JavaMail as payload of an email.

The email is created and sent after submitting a Wicket form.
The WebPage is rendered with the following method:

public String renderTemplate(WebPage webPage) {

    BufferedWebResponse bufferedWebResponse = new BufferedWebResponse(null);
    webPage.getRequestCycle().setResponse(bufferedWebResponse);
    webPage.render();
               
    return bufferedWebResponse.getText().toString();
}

It works and in my opinion this is an elegant solution though I'm not too
sure about it.
In Wicket 1.4 I used more code to do the same:
http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/

Am I missing something? 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Render-WebPage-to-String-in-Wicket-1-5-tp3622130p3622130.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to