You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bhaarat Sharma <bh...@gmail.com> on 2009/06/04 00:05:12 UTC
struts2 locale question
is there a way in struts2 to create a locale in the properties file and then
substitue values to it?
For example:
in properties file:
myApp.Welcome = "Hello ?"
then when we call this locale we can pass in some value for '?'
<s:text name="myApp.Welcome"><s:parm value="World"/></stext>
<br>
<s:text name="myApp.Welcome"><s:parm value="John"/></stext>
This would print:
Hello World
Hello John
Thanks
-bhaarat
Re: struts2 locale question
Posted by Dave Newton <ne...@yahoo.com>.
Bhaarat Sharma wrote:
> I am doing this but not working
> imi.welcome = Hello {0}
>
> <s:text name="imi. welcome "><s:param value="%{World}"/></s:text>
Unless you have a property named "World", it won't. You probably mean to
send an immediate string, the OGNL for which is %{'World'}.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: struts2 locale question
Posted by Bhaarat Sharma <bh...@gmail.com>.
I am doing this but not working
imi.welcome = Hello {0}
<s:text name="imi. welcome "><s:param value="%{World}"/></s:text>
On Wed, Jun 3, 2009 at 7:16 PM, Dave Newton <ne...@yahoo.com> wrote:
> Bhaarat Sharma wrote:
>
>> is there a way in struts2 to create a locale in the properties file and
>> then
>> substitue values to it?
>> For example:
>> in properties file:
>> myApp.Welcome = "Hello ?"
>>
>> then when we call this locale we can pass in some value for '?'
>>
>> <s:text name="myApp.Welcome"><s:parm value="World"/></stext>
>> <br>
>> <s:text name="myApp.Welcome"><s:parm value="John"/></stext>
>>
>> This would print:
>> Hello World
>> Hello John
>>
>
> You can do it using positional parameters like regular Java, or use OGNL
> expressions in the message.
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: struts2 locale question
Posted by Dave Newton <ne...@yahoo.com>.
Bhaarat Sharma wrote:
> is there a way in struts2 to create a locale in the properties file and then
> substitue values to it?
> For example:
> in properties file:
> myApp.Welcome = "Hello ?"
>
> then when we call this locale we can pass in some value for '?'
>
> <s:text name="myApp.Welcome"><s:parm value="World"/></stext>
> <br>
> <s:text name="myApp.Welcome"><s:parm value="John"/></stext>
>
> This would print:
> Hello World
> Hello John
You can do it using positional parameters like regular Java, or use OGNL
expressions in the message.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org