Here is another way I used when I was in need of this feature. This one
simulates a request cycle. I don't know if you could adapt this to fit your
needs (maybe doing the same, but with the real requestCycle instead) ?

http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/

Cheers,
Xavier

2010/3/16 rolandpeng <rolandp...@cht.com.tw>

>
> That works , thank you!
> But I have another question:
> when I use requestLogger.getLiveSessions() to get the live sessions,the
> number of sessions always increased after I call the render api.
> Is it possible to render page of html source in the same session(not create
> a new one)?
> Thank you!
>
>
> Scott Swank wrote:
> >
> > Here is a largely equivalent class that I created.  It simply extends
> > BaseWicketTester.
> >
> > public class PageRenderer extends BaseWicketTester {
> >       private final Locale locale;
> >
> >       public PageRenderer(Locale locale) {
> >               this.locale = locale;
> >       }
> >
> >       public PageRenderer() {
> >               this.locale = null;
> >       }
> >
> >       private String renderStartPage() {
> >               if (this.locale != null) {
> >                       getWicketSession().setLocale(locale);
> >               }
> >
> >               return getServletResponse().getDocument();
> >       }
> >
> >       public synchronized String render(Class<? extends WebPage>
> pageClass) {
> >               startPage(pageClass);
> >               return renderStartPage();
> >       }
> >
> >       public synchronized String render(Class<? extends WebPage>
> pageClass,
> > PageParameters parameters) {
> >               startPage(pageClass, parameters);
> >               return renderStartPage();
> >       }
> >
> >       public synchronized String render(WebPage page) {
> >               startPage(page);
> >               return renderStartPage();
> >       }
> >
> > }
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/Render-a-Wicket-page-to-a-string-for-HTML-email-tp20325702p27914411.html
> Sent from the Wicket - User 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
>
>


-- 
"Klein bottle for rent--inquire within."

Reply via email to