Thanks Jason,
<s:text name="%{myKey}" />
Will be fine as normally it will just be a property to return not a
method call.. The glaringly obvious error in hindsight was having left
the 'get' part on the property name..
Doh!
On 31/05/2011 19:56, Jason Pyeron wrote:
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- -
- Jason Pyeron PD Inc. http://www.pdinc.us -
- Principal Consultant 10 West 24th Street #100 -
- +1 (443) 269-1555 x333 Baltimore, Maryland 21218 -
- -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.
-----Original Message-----
From: Marcus Bond [mailto:mar...@marcusbond.me.uk]
Sent: Tuesday, May 31, 2011 14:41
To: Struts Users Mailing List
Subject: Re: Dynamic text
Thanks for the link but still not quite what I'm looking
for.. I've made a simple example below, however note that I
am not extending ActionSupport in any of my actions:
Action has method (could return different value than 'goodbye')
public String getMyKey() {
return "goodbye";
}
resource file has keys:
hello=Hello There!
goodbye=See you later!
page has tags:
<s:text name="hello" /> This works fine<br /> <s:text
name="%{getMyKey}" /> Nope<br /> <s:text name="#getMyKey" />
Try:<s:text name="%{myKey}" />, it works for me with your example.
If you want to call a method you should:<s:text name="%{getMyKey()}" />
Nope<br />
<s:property value="getMyKey" /> This returns nothing<br />
<s:property value="%{getMyKey}" /> This returns nothing<br
/> <s:property value="getText(#getMyKey)" /> This returns
nothing<br />
On 31/05/2011 15:38, Jason Pyeron wrote:
-----Original Message-----
From: Marcus Bond
Sent: Tuesday, May 31, 2011 10:26
To: Struts Users Mailing List
Subject: Dynamic text
Hi,
I want to use some view objects in my action that will contain
resource keys and then show these using s:text to resolve
the key to
it's translation.. Is this type of thing supported? I know
a lot of
tags moan if you try and use any ${foo.bar} type arguments
Have you taken a look at
http://struts.apache.org/2.x/docs/localization.html
yet?
If so could you please post a specific problem?
-Jason
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- -
- Jason Pyeron PD Inc. http://www.pdinc.us -
- Principal Consultant 10 West 24th Street #100 -
- +1 (443) 269-1555 x333 Baltimore, Maryland 21218 -
- -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org