You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by cmoulliard <cm...@gmail.com> on 2009/02/02 11:09:44 UTC

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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to personalise HTML content with Wicket ?

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Wicket has very powerful means to do skinning... See
http://cwiki.apache.org/WICKET/localization-and-skinning-of-applications.html

for a start... Besides that you could do all kind of tricks working with
panels and component visibility: depending on conditions show one (hide
one/replace with another) panel. The difference is the logic will be on the
Java side and not in the JSP page...

Best

Ernesto

On Mon, Feb 2, 2009 at 11:09 AM, cmoulliard <cm...@gmail.com> wrote:

>
> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

AW: How to personalise HTML content with Wicket ?

Posted by Stefan Lindner <li...@visionet.de>.
My answer was not ment ironically. I understand what you mean I too prefer the Panel/Loop way. I just wanted to give a simple answer to a simple question of a wicket beginner. I think that Charles has a good starting point now for further wicket experiences.

-----Ursprüngliche Nachricht-----
Von: Ernesto Reinaldo Barreiro [mailto:reiern70@gmail.com] 
Gesendet: Montag, 2. Februar 2009 12:31
An: users@wicket.apache.org
Betreff: Re: How to personalise HTML content with Wicket ?

Hi Stefan,
All wanted to stress is the fact that there are very few cases where you
will want to generate the HTML by hand... Then what would be the point in
using Wicket? And in this particular case I personally would prefer to use
panels...

Best,

Ernesto

On Mon, Feb 2, 2009 at 12:18 PM, Stefan Lindner <li...@visionet.de> wrote:

> Of course! And: why not use wicket's Loop for generating each <tr> and
> nested Loop for building each <td> etc. The Examples were just a starting
> point for doing simple things like few text labels spread around the page.
>
> -----Ursprüngliche Nachricht-----
> Von: Ernesto Reinaldo Barreiro [mailto:reiern70@gmail.com]
> Gesendet: Montag, 2. Februar 2009 12:04
> An: users@wicket.apache.org
> Betreff: Re: How to personalise HTML content with Wicket ?
>
> 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 <li...@visionet.de>
> 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:cmoulliard@gmail.com]
> > Gesendet: Montag, 2. Februar 2009 11:26
> > An: users@wicket.apache.org
> > 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:cmoulliard@gmail.com]
> > > Gesendet: Montag, 2. Februar 2009 11:10
> > > An: users@wicket.apache.org
> > > 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: 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
> > >
> > >
> > >
> >
> >
> > -----
> > 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: 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
>
>

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


Re: How to personalise HTML content with Wicket ?

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Hi Stefan,
All wanted to stress is the fact that there are very few cases where you
will want to generate the HTML by hand... Then what would be the point in
using Wicket? And in this particular case I personally would prefer to use
panels...

Best,

Ernesto

On Mon, Feb 2, 2009 at 12:18 PM, Stefan Lindner <li...@visionet.de> wrote:

> Of course! And: why not use wicket's Loop for generating each <tr> and
> nested Loop for building each <td> etc. The Examples were just a starting
> point for doing simple things like few text labels spread around the page.
>
> -----Ursprüngliche Nachricht-----
> Von: Ernesto Reinaldo Barreiro [mailto:reiern70@gmail.com]
> Gesendet: Montag, 2. Februar 2009 12:04
> An: users@wicket.apache.org
> Betreff: Re: How to personalise HTML content with Wicket ?
>
> 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 <li...@visionet.de>
> 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:cmoulliard@gmail.com]
> > Gesendet: Montag, 2. Februar 2009 11:26
> > An: users@wicket.apache.org
> > 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:cmoulliard@gmail.com]
> > > Gesendet: Montag, 2. Februar 2009 11:10
> > > An: users@wicket.apache.org
> > > 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: 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
> > >
> > >
> > >
> >
> >
> > -----
> > 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: 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
>
>

AW: How to personalise HTML content with Wicket ?

Posted by Stefan Lindner <li...@visionet.de>.
Of course! And: why not use wicket's Loop for generating each <tr> and nested Loop for building each <td> etc. The Examples were just a starting point for doing simple things like few text labels spread around the page.

-----Ursprüngliche Nachricht-----
Von: Ernesto Reinaldo Barreiro [mailto:reiern70@gmail.com] 
Gesendet: Montag, 2. Februar 2009 12:04
An: users@wicket.apache.org
Betreff: Re: How to personalise HTML content with Wicket ?

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 <li...@visionet.de> 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:cmoulliard@gmail.com]
> Gesendet: Montag, 2. Februar 2009 11:26
> An: users@wicket.apache.org
> 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:cmoulliard@gmail.com]
> > Gesendet: Montag, 2. Februar 2009 11:10
> > An: users@wicket.apache.org
> > 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: 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
> >
> >
> >
>
>
> -----
> 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: 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: How to personalise HTML content with Wicket ?

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
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 <li...@visionet.de> 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:cmoulliard@gmail.com]
> Gesendet: Montag, 2. Februar 2009 11:26
> An: users@wicket.apache.org
> 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:cmoulliard@gmail.com]
> > Gesendet: Montag, 2. Februar 2009 11:10
> > An: users@wicket.apache.org
> > 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: 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
> >
> >
> >
>
>
> -----
> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

RE: How to personalise HTML content with Wicket ?

Posted by Stefan Lindner <li...@visionet.de>.
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:cmoulliard@gmail.com] 
Gesendet: Montag, 2. Februar 2009 11:26
An: users@wicket.apache.org
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:cmoulliard@gmail.com] 
> Gesendet: Montag, 2. Februar 2009 11:10
> An: users@wicket.apache.org
> 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: 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
> 
> 
> 


-----
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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: How to personalise HTML content with Wicket ?

Posted by cmoulliard <cm...@gmail.com>.
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:cmoulliard@gmail.com] 
> Gesendet: Montag, 2. Februar 2009 11:10
> An: users@wicket.apache.org
> 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: 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
> 
> 
> 


-----
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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: How to personalise HTML content with Wicket ?

Posted by Stefan Lindner <li...@visionet.de>.
Several Ways to to this. The easiest way for your example


HTML:
<H2><span wicket:id="content"/><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:cmoulliard@gmail.com] 
Gesendet: Montag, 2. Februar 2009 11:10
An: users@wicket.apache.org
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: 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