>> <label><s:text name="label.welcome"><s:param>John</s:param></s:text></label>
This one works!

> label.welcome = Welcome {name}
>
> <s:label key="label.welcome">
> <s:param name="name">John</s:param>
> </s:label>
>
This one doesn't work, it displayed a colon ":" instead of the message
from the i18n properties file.

> label.welcome = Welcome {0}
>
> <s:label key="label.welcome">
> <s:param>John</s:param>
> </s:label>
>
This will throw the following exception,
java.lang.NullPointerException
        at 
com.opensymphony.xwork2.util.TextParseUtil.translateVariables(TextParseUtil.java:121)
        at 
com.opensymphony.xwork2.util.TextParseUtil.translateVariables(TextParseUtil.java:100)
        at 
com.opensymphony.xwork2.util.TextParseUtil.translateVariables(TextParseUtil.java:73)
        at org.apache.struts2.components.Component.findValue(Component.java:313)
        at 
org.apache.struts2.components.Component.findString(Component.java:194)
        ...

On Feb 12, 2008 7:21 AM, Wes Wannemacher <[EMAIL PROTECTED]> wrote:
> IIRC, you can use named parameters. If you want to keep the {name}, use
>
> label.welcome = Welcome {name}
>
> <s:label key="label.welcome">
> <s:param name="name">John</s:param>
> </s:label>
>
>
>
>
> On Mon, 2008-02-11 at 09:10 -0800, Chris Pratt wrote:
> > Change your property to
> >
> > label.welcome = Welcome {0}
> >
> > Then you might try:
> >
> > <s:label key="label.welcome">
> >   <s:param>John</s:param>
> > </s:label>
> >
> > If that doesn't work, you should be able to use:
> >
> > <label><s:text name="label.welcome"><s:param>John</s:param></s:text></label>
> >
> >   (*Chris*)
> >
> > On Feb 11, 2008 7:13 AM, hezjing <[EMAIL PROTECTED]> wrote:
> > > Hi
> > >
> > > If I have a message defined in i18n properties file shown below,
> > >
> > >     label.welcome = Welcome ${name}
> > >
> > > How can I subsitute the variable "name" in the JSP?
> > > I tried the following and obviously it doesn't work!
> > >
> > >     <s:label key="label.welcome">
> > >     <s:param name="name">John</s:param>
> > >     </s:label>
> > >
> > >
> > > May be it is a good idea to describe the solution in
> > > http://struts.apache.org/2.x/docs/localization.html?
> > >
> > >
> > > --
> > >
> > > Hez
> > >
> > > ---------------------------------------------------------------------
> > > 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]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 

Hez

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to