You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by David Chang <da...@yahoo.com> on 2010/03/25 04:42:24 UTC

How to provide a value to a message's argument

HTML:

<span wicket:id="x">[sample text]</span>

Java:

add(new Label("x", new ResourceModel("x")));

Resource file:

<entry key="x">Hello ${label} !</entry>

In the above Java, I cannot find a way to provide a value to the argument of the string. I want the program to display 

Hello David! 
Hello Carmen!

Regards.


      

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


Re: How to provide a value to a message's argument

Posted by David Chang <da...@yahoo.com>.
Igor, thanks for the info. It worked for me. Just a suggestion. Hope to see a convenience constructor such as:

StringResourceModel(resourceKey, java.lang.Object[] parameters)

In which, model is null. IMHO, Spring has many convenience methods. It would be good to see Wicket does the same (maybe already does it, but I dont know about).

Regards.

--- On Wed, 3/24/10, Igor Vaynberg <ig...@gmail.com> wrote:

> From: Igor Vaynberg <ig...@gmail.com>
> Subject: Re: How to provide a value to a message's argument
> To: users@wicket.apache.org
> Date: Wednesday, March 24, 2010, 11:49 PM
> see StringResourceModel
> 
> -igor
> 
> On Wed, Mar 24, 2010 at 8:42 PM, David Chang <da...@yahoo.com>
> wrote:
> >
> > HTML:
> >
> > <span wicket:id="x">[sample text]</span>
> >
> > Java:
> >
> > add(new Label("x", new ResourceModel("x")));
> >
> > Resource file:
> >
> > <entry key="x">Hello ${label} !</entry>
> >
> > In the above Java, I cannot find a way to provide a
> value to the argument of the string. I want the program to
> display
> >
> > Hello David!
> > Hello Carmen!
> >
> > Regards.
> >
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > 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 provide a value to a message's argument

Posted by Igor Vaynberg <ig...@gmail.com>.
see StringResourceModel

-igor

On Wed, Mar 24, 2010 at 8:42 PM, David Chang <da...@yahoo.com> wrote:
>
> HTML:
>
> <span wicket:id="x">[sample text]</span>
>
> Java:
>
> add(new Label("x", new ResourceModel("x")));
>
> Resource file:
>
> <entry key="x">Hello ${label} !</entry>
>
> In the above Java, I cannot find a way to provide a value to the argument of the string. I want the program to display
>
> Hello David!
> Hello Carmen!
>
> Regards.
>
>
>
>
> ---------------------------------------------------------------------
> 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