You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by pkc <pk...@gmail.com> on 2012/02/18 05:36:20 UTC

Wicket as a templating engine

I'm using wicket page inheritance to take care of consistent look and feel
for pages but I'm stuck on one detail...

In the markup for a WebPage,  I need to insert dynamic text in lots of
places.  What is the closest wicket has to something like this:

<html><body>add text here <wicket:call=&quot;theThing&quot;>, and also here
<wicket:call=&quot;theThing&quot;>, and in a few other places
too.</body></html>

class ExamplePage extends WebPage{
  String xyz;
...
  public String getTheThing(){ return xyz + new Date().toString(); }
}

I was thinking adding a label and turning off the tags, or maybe use
wicket:message somehow?  I am looking for a concise way to do it.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-as-a-templating-engine-tp4399165p4399165.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Wicket as a templating engine

Posted by pkc <pk...@gmail.com>.
Interesting.  I may try to make a generic <wicket:insert=&quot;abc.xyz&quot;>
tag that uses the page's default property model to resolve the "abc.xyz".
Will this work?  

Two other "cool" things I'm looking for:

1) Does <wicket:extend> support a codeBehind attribute?  Say I have 20
stateless pages and I want them all to extend one BasePage and then use my
<wicket:insert> tag for the fairly simple dynamic stuff.

2) To avoid "tag soup", I don't want things like if statements or loops in
the templates.  However, I would like to have <wicket:insert> support
property model values that resolve to collections.  So can someone suggest a
way to use repeaters in a generic way?  Something like this:
  <wicket:insert=&quot;addressList&quot; item=&quot;address&quot;>
    <wicket:insert=&quot;address.firstName&quot;/><br/>
  </wicket:insert>

If I can get this much working, I can wicket for the entire site!

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-as-a-templating-engine-tp4399165p4399701.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Wicket as a templating engine

Posted by Igor Vaynberg <ig...@gmail.com>.
write your own tag handler. use wicket:message as a template. see
WicketMessageResolver and WicketMessageTagHandler

-igor

On Fri, Feb 17, 2012 at 8:36 PM, pkc <pk...@gmail.com> wrote:
> I'm using wicket page inheritance to take care of consistent look and feel
> for pages but I'm stuck on one detail...
>
> In the markup for a WebPage,  I need to insert dynamic text in lots of
> places.  What is the closest wicket has to something like this:
>
> <html><body>add text here <wicket:call=&quot;theThing&quot;>, and also here
> <wicket:call=&quot;theThing&quot;>, and in a few other places
> too.</body></html>
>
> class ExamplePage extends WebPage{
>  String xyz;
> ...
>  public String getTheThing(){ return xyz + new Date().toString(); }
> }
>
> I was thinking adding a label and turning off the tags, or maybe use
> wicket:message somehow?  I am looking for a concise way to do it.
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-as-a-templating-engine-tp4399165p4399165.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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