You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by kan <ka...@gmail.com> on 2008/08/27 04:14:46 UTC

Use wicket page templates not for webapplication

Can I render a page but not in web environment? E.g. I want to create
an javax.mail with html-body and want to reuse my wicket components to
generate content. So, no servlets, no sessions, no requests/responses,
no ajax - just render a page to a stream.

-- 
WBR, kan.

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


Re: Use wicket page templates not for webapplication

Posted by James Carman <ja...@carmanconsulting.com>.
I would check the archives.  This question has been asked/answered
many times before.  I'm sure you'll find some example code.

On Tue, Aug 26, 2008 at 10:14 PM, kan <ka...@gmail.com> wrote:
> Can I render a page but not in web environment? E.g. I want to create
> an javax.mail with html-body and want to reuse my wicket components to
> generate content. So, no servlets, no sessions, no requests/responses,
> no ajax - just render a page to a stream.
>
> --
> WBR, kan.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Use wicket page templates not for webapplication

Posted by kan <ka...@gmail.com>.
http://cwiki.apache.org/WICKET/use-wicket-as-template-engine.html

-- 
WBR, kan.

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


Re: Use wicket page templates not for webapplication

Posted by Antoine Angenieux <aa...@clinigrid.com>.
Hi Kan,

I've been looking into this problem for some time, and I'm really 
interested in your solution, if you mind sharing !

As I've seend this kind of thread popup on the mailing list every 6 
months or so with no real solution to the problem at hand, maybe you 
could add it to the Wiki if the core dev are OK with it ?

thx,

Antoine.

kan wrote:
> 2008/8/27 Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>:
> 
>> I did something similar once, but realized somewhere in the process that it
>> werent exactly the same content writing a mail as the web page. I used the
>> wicket text templates heavy instead.
> Ok, I've made it. I've created "class TemplaterApplication extends
> Application" (and all related classes Request, RequestCycle, etc) and
> WicketTemplater over it. It takes TemplatePage (child of wicket.Page)
> implementation and writes result to given java.io.Writer. All stuff
> like sessions, versioning, request parameters are disabled,
> TemplatePage is always stateless.
> Yes, web page is not the same as email, but very-very close. Of
> course, it's nearly impossible to reuse the same WebPage, but you can
> reuse some your components both on WebPage and TemplatePage. And of
> course it's possible to use most standard wicket components like
> wicket:border, wicket:extend, repeaters, etc...
> Yet another great benefits, but I've not done it yet:
> - it's possible to make auto-linking of resources. Say, if you have
> <img> on your page, the generated email will have the image attached
> and properly linked as "cid:" resource.
> - if you have a link in email to your web-site back, it could be
> properly handled and checked if it actually links to correct Page.
> 
> If somebody find it interesting, I can to share my code and actually
> it's possible to make "html templater" and "html email generator" as
> yet another library.
> 




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


Re: Use wicket page templates not for webapplication

Posted by kan <ka...@gmail.com>.
2008/8/27 Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>:

> I did something similar once, but realized somewhere in the process that it
> werent exactly the same content writing a mail as the web page. I used the
> wicket text templates heavy instead.
Ok, I've made it. I've created "class TemplaterApplication extends
Application" (and all related classes Request, RequestCycle, etc) and
WicketTemplater over it. It takes TemplatePage (child of wicket.Page)
implementation and writes result to given java.io.Writer. All stuff
like sessions, versioning, request parameters are disabled,
TemplatePage is always stateless.
Yes, web page is not the same as email, but very-very close. Of
course, it's nearly impossible to reuse the same WebPage, but you can
reuse some your components both on WebPage and TemplatePage. And of
course it's possible to use most standard wicket components like
wicket:border, wicket:extend, repeaters, etc...
Yet another great benefits, but I've not done it yet:
- it's possible to make auto-linking of resources. Say, if you have
<img> on your page, the generated email will have the image attached
and properly linked as "cid:" resource.
- if you have a link in email to your web-site back, it could be
properly handled and checked if it actually links to correct Page.

If somebody find it interesting, I can to share my code and actually
it's possible to make "html templater" and "html email generator" as
yet another library.

-- 
WBR, kan.

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


Re: Use wicket page templates not for webapplication

Posted by Scott Swank <sc...@gmail.com>.
http://cwiki.apache.org/confluence/display/WICKET/FAQs#FAQs-HowcanIrendermytemplatestoaString%3F


On Tue, Aug 26, 2008 at 10:43 PM, Nino Saturnino Martinez Vazquez Wael
<ni...@jayway.dk> wrote:
> Kan, please put in your findings in a page on the wiki (maybe under faq).
> Seems it's something people do once in a while..
>
> I did something similar once, but realized somewhere in the process that it
> werent exactly the same content writing a mail as the web page. I used the
> wicket text templates heavy instead.
>
> kan wrote:
>>
>> Can I render a page but not in web environment? E.g. I want to create
>> an javax.mail with html-body and want to reuse my wicket components to
>> generate content. So, no servlets, no sessions, no requests/responses,
>> no ajax - just render a page to a stream.
>>
>>
>
> --
> -Wicket for love
>
> Nino Martinez Wael
> Java Specialist @ Jayway DK
> http://www.jayway.dk
> +45 2936 7684
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Use wicket page templates not for webapplication

Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
Kan, please put in your findings in a page on the wiki (maybe under 
faq). Seems it's something people do once in a while..

I did something similar once, but realized somewhere in the process that 
it werent exactly the same content writing a mail as the web page. I 
used the wicket text templates heavy instead.

kan wrote:
> Can I render a page but not in web environment? E.g. I want to create
> an javax.mail with html-body and want to reuse my wicket components to
> generate content. So, no servlets, no sessions, no requests/responses,
> no ajax - just render a page to a stream.
>
>   

-- 
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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