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 problem with message resources 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 "problem with message resources" Watch "problem with message resources" New topic
Author

problem with message resources

shankar reddy
Ranch Hand

Joined: Jun 04, 2007
Posts: 71
have changed the brower language settings to other countries, i am not getting the required pages depending upon the languages changes. but i have observed that the .properties file present in the last is executing every time.

example:
<message-resources parameter="com/myapp/struts/ApplicationResource"/>
<message-resources parameter="com/myapp/struts/Application_fr"/>
<message-resources parameter="com/myapp/struts/Application_en"/>
<message-resources parameter="com/myapp/struts/Application_de"/>


so Application_de.properties file is executing ,
if i keep Application_fr.properties as the last line then the _fr.properties file is executing.

could any one help me.


Java Lover<br /> <br />Shankar Reddy <br />SCJP1.4 (88%)
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You've misunderstood how to define resource files. The name you define in the struts-config.xml file represents a bundle or group of files. The group is represented by a name without a language suffix. Struts will then append the appropriate language suffix when it determines which language the browser is set to use. So, your example, you should rename the file ApplicationResource.properties to Application.properties and change your struts-config.xml file so it has only the following entry for message resources:

Struts will then check the language of the browser and look for a file with the appropriate language suffix (e.g. Application_en.properties) and if it doesn't find that file it will use the default file of Application.properties.


Merrill
Consultant, Sima Solutions
shankar reddy
Ranch Hand

Joined: Jun 04, 2007
Posts: 71
can anyone give the solution ...
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Originally posted by shankar reddy telukutla:
can anyone give the solution ...

It's a little disturbing that I spent my time posting an answer your question, and you don't even acknowledge that any response was given.

If you don't think this is the right solution, or you tried it and it didn't work, please let us know. It's a bit rude, though, to just pretend that no response was given.
prakash chauhan
Ranch Hand

Joined: Jun 22, 2007
Posts: 81
okay i dint know that the suffix for the country is added automatically..
now i might be asked to post it in a different thread but as the discussion is on , i just wanted to confirm do we have to have the .properties files along with other .class files?
and why is that so?
-Thanks
 
jQuery in Action, 2nd edition
 
subject: problem with message resources
 
Similar Threads
Struts error
resource bundle from JAR file?
ApplicationResource. properties file ?
Struts Without Form Bean
where to place properties file in sturts?