Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
rajeshkannan sella
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
 
David Newton
Author
Rancher
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
Rancher
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
 
Mudit Srivastava
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic