Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Need Help in accesing the bundle / key value in action class

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

The following two lines are in strutsconfig.xml
one for english and one or welsh language

<message-resources parameter="com.ips.ApplicationResources" null="false"/>
<message-resources parameter="com.ips.ApplicationResources_cy" key="welsh" null="false" />

in my jsp
its for welsh
<label class="error" id="titleerror">
<bean:message bundle="welsh" key="errors.title.required" />
</label>


for english
<label class="error" id="titleerror">
<bean:message key="errors.title.required" />
</label>

i want to access the value of keyattribute of message-resource of struts-config.xml in my action class or the value of bundle attribute of bean:message tag in my action class?

can you suggest me the options?

Thanks
Rajesh
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A couple of seconds on Google returned a first page full of examples. Try searching for "struts +access message bundle in action" or something similar.
 
rajeshkannan sella
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried googling its no worthful to meet my requirement.

suggest me some ideas
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't really know what your requirement is.

What, specifically, are you trying to do? Normally the locale is set by the user's browser, or over-ridden by a session variable (as when the user wants to use a specific language no matter what the browser provides).
 
rajeshkannan sella
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi David,
Actually is there any option to set the Locale in jsp?
for welsh i want to set locale as cy and want to get that value in my action class?
will it be possible?

Thanks
Rajesh
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can give a drop down with a key-value pair, containing the Locale ID as the key and name of the language as the value. Upon selecting the language, the key can be passed back to the action class, which you can set in your session.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic