<!-- define your servlet to accept ApplicationResources -->
<servlet-class>
    org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>
    application
</param-name>
<param-value>
    de.laliluna.tutorials.library.struts.ApplicationResources
</param-value>
</init-param>
<!-- define which ApplicationResource to access from list in 
param-name/param-value -->
<message-resources key="moreResources" 
parameter="de.laliluna.tutorials.library.struts.MoreApplicationResources"/><!-- 
populate values in ApplicationResources.properties -->
label.username=Username
label.password=Password
label.first.name=First Name
label.last.name=Last Name
label.email=Email Address
label.phone.number=Phone Number
label.welcome=Welcome back {0} {1}!
error.min.length=The input must be at least {0} characters in length.
error.max.length=The input cannot be longer than {0} characters in length.<!-- 
in jsp use the bean:message tag to display contents of the attribute -->
<bean:message key="label.password"/><!-- there is an internationalisation 
interceptor from WW available in struts2 -->

<!-- this from the german site lailuna (originally targeted for Struts1) -->
http://www.laliluna.de/articles/struts-message-resources-tutorial.html

Martin 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




> Date: Tue, 31 May 2011 19:40:43 +0100
> From: mar...@marcusbond.me.uk
> To: user@struts.apache.org
> 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" /> 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
> 
                                          

Reply via email to