This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts 2 internationalization with a dynamic key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 internationalization with a dynamic key" Watch "Struts 2 internationalization with a dynamic key" New topic
Author

Struts 2 internationalization with a dynamic key

felipe issa
Greenhorn

Joined: Sep 26, 2011
Posts: 3

Hi.

I'm trying to internationalize an application, but I can't pass a key to the <s:text/> dynamically. Instead of recovering the value from the properties file, the key is being displayed at the page to the user.

This is my example action:



This is my TestAction.properties file:



When i pass the key directly into the JSP the struts recover the correct value..



But when i try to get the key from the java action, instead of looking for it's value it just show's the key! I've tried the followings ways to recover the text:




but none of them works.. does anyone have an idea how to solve this?

Thanks!

debraj mallick
Ranch Hand

Joined: Mar 08, 2011
Posts: 188

hi felipe issa,

i did not understand what you are trying to do in your application,
anyway you can get the value of the key in action also, like

hope this would help you.


felipe issa
Greenhorn

Joined: Sep 26, 2011
Posts: 3

Hi debraj mallick!

That doesn't work on my case. I'll use the properties file to internationalize the application. When the user is from Us, for instance, the struts will get the value from the default file TestAction.properties. But when user is from other countries, like Brazil, struts will look for the value in the properties file 'TestAction_br.properties' for the value (or in the default file when it doesn't exists.)

But thanks for your answer anyway!
felipe issa
Greenhorn

Joined: Sep 26, 2011
Posts: 3

Resolved it using

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Struts 2 internationalization with a dynamic key
 
Similar Threads
s:radio and display tag
[solved] passing 3 times by default through action using struts 2
[Struts 2] How to populate select control after selection of a value in another select control
<s:property value=""> in comparison
passing form parameters such us textfield values using url tag