For this case why not have "<table>........</table>"  in a panel (or
fragment) and use it instead of generating the string "by hand"?  IMHO that
would be much more clear and consistent with wicket way of doing things...
Best

Ernesto

On Mon, Feb 2, 2009 at 11:47 AM, Stefan Lindner <[email protected]> wrote:

> Yes, you just have to tell the e.g. Label component not to escapte the
> model's content (label.setExcapteModelStrings(false)) Then the model's
> string is inserted into the HTML output without any further processing.
> You always need a html tag with wicket:id to trigger the output.
>
>
> HTML
> <div wicket:id="raw"/>
>
> Java
> Label l = new Label("raw", "<table>........</table>");
> l.setEscapeModelStrings(false);
> l.setRenderGodyOnly(true);
> add(l);
>
>
> -----Ursprüngliche Nachricht-----
> Von: cmoulliard [mailto:[email protected]]
> Gesendet: Montag, 2. Februar 2009 11:26
> An: [email protected]
> Betreff: RE: How to personalise HTML content with Wicket ?
>
>
> Thks.
>
> Can I also use Model to define HTML section containing regular HTML with
> wicket id ?
>
> <table>
> <td><tr><tr><tr></td>
> <td wicket id="">
> ....
>
> Additional question : in this case, where content is define dynamically,
> which java class will trigger the wicket tags ?
>
>
> Stefan Lindner wrote:
> >
> > Several Ways to to this. The easiest way for your example
> >
> >
> > HTML:
> > <H2><H2/>
> >
> > In Java
> > Model<String> contentModel = new Model<String("");
> > add(new Label("content", contentModel));
> > if (user=='admin'=
> >    contenModel.setObject("Admin part");
> > else if (user == 'anonymous')
> >    contenModel.setObject("Anonymous part");
> >
> >
> >
> >
> >
> > Or in JAVA
> > if (user=='admin'=
> >    add(new Label("content", ("Admin part"));
> > else if (user == 'anonymous')
> >    add(new Label("content", ("Anonymous part"));
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: cmoulliard [mailto:[email protected]]
> > Gesendet: Montag, 2. Februar 2009 11:10
> > An: [email protected]
> > Betreff: How to personalise HTML content with Wicket ?
> >
> >
> > Hi,
> >
> > I would like to know how we can personalize the content with Wicket ?
> >
> > With framework like Struts, ... it is possible in a JSP page to display
> > different HTML contents (let's say personalize content) according to
> > conditions (e.g. profile user, ...).
> >
> > if (user == 'admin')
> >
> > <H2>Admin part<H2/>
> >
> > if ( user == 'anonymous')
> >
> > <H2>Anonymous part</H2>
> >
> > Regards,
> >
> > Charles
> >
> >
> >
> >
> > -----
> > Charles Moulliard
> > SOA Architect
> >
> > My Blog :  http://cmoulliard.blogspot.com/
> http://cmoulliard.blogspot.com/
> > --
> > View this message in context:
> >
> http://www.nabble.com/How-to-personalise-HTML-content-with-Wicket---tp21787067p21787067.html
> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
> >
>
>
> -----
> Charles Moulliard
> SOA Architect
>
> My Blog :  http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/
> --
> View this message in context:
> http://www.nabble.com/How-to-personalise-HTML-content-with-Wicket---tp21787067p21787287.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to