struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adam pinder <apin...@hotmail.co.uk>
Subject RE: Passing parameters to <s:property>
Date Thu, 04 Mar 2010 17:25:32 GMT

 

use an alias in the getName call like so

 

<s:property value="getName('US')"/>

 

this will still call getName but pass the string "US" then make the class method getName do
the locale related work.

 

you can't pass an object in a property call as far as i know only a primitive/string.

 

i still think you should be looking at this differently and using the i18n interceptor and
resource bundles to handle different languages.

 

adam


 
> Date: Thu, 4 Mar 2010 17:13:43 +0000
> Subject: Re: Passing parameters to <s:property>
> From: rvjsapi@gmail.com
> To: user@struts.apache.org
> 
> Thank you for your reply.
> 
> I don't have a getName in my action class if that's what you mean.
> 
> I'm using an iterator so the getName is a method from the class's object
> defined in the iterator's value option. That class also makes available a
> getName(Locale locale).
> 
> Locale is a class (java.util.Locale).
> 
> PS: I've just tried the following but it did not work
> <s:property value="name(@java.util.Locale@US)" />
> 
> Best Regards
> Ricardo
> 
> On Thu, Mar 4, 2010 at 4:51 PM, Lukasz Lenart
> <lukasz.lenart@googlemail.com>wrote:
> 
> > 2010/3/4 Ricardo Jorge <rvjsapi@gmail.com>:
> > > <s:property value="name(Locale.US)" />
> >
> > Did you define method name(Locale locale) in your class? Or just
> > getName(Locale locale)? For second case use
> > <s:property value="getName(Locale.US)" /> or <s:property
> > value="%{getName(Locale.US)}" />
> >
> >
> > Regards
> > --
> > Łukasz
> > http://www.lenart.org.pl/
> > Kapituła Javarsovia 2010
> > http://javarsovia.pl
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
 		 	   		  
_________________________________________________________________
Got a cool Hotmail story? Tell us now
http://clk.atdmt.com/UKM/go/195013117/direct/01/
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message