File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Getting dynamically 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 "Getting dynamically" Watch "Getting dynamically" New topic

Getting dynamically

Fawad Ali
Ranch Hand

Joined: Dec 28, 2009
Posts: 112
Hi All,
I want to get the properties files dynamically for internationalization based on some conditions. How can I do that? Let me explain the scenario a bit. I have an application running different events. Each event has its own properties file for Spanish, Italian languages etc. If I place the properties files in /Events/{eventName}/, then, is there any way in Struts to get the required properties file for a specific event dynamically at run time.

Thanks in advance.

Regards, Fawad Ali.
Software Engineer, Stafona Inc. - My Blog
Fawad Ali
Ranch Hand

Joined: Dec 28, 2009
Posts: 112
To explain more precisely. I have two events eventA and eventB. Both have different property files. If I want to visit an action named abc.action with eventA then the Struts tags should take the key, value pair for internationalization from a file at /Events/eventA/ If I want to visi the same action (abc.action) with eventB, then the properties file should be read from /Events/eventB/

Basically I want to overwrite the Struts default path for Internationalization which is resources folder right now. Is it possible with Struts and struts tags or not?

BTW, I am using Struts 2.0.
Fawad Ali
Ranch Hand

Joined: Dec 28, 2009
Posts: 112
Still no reply from anyone . I have, although, looked a bit into the tags and found that can be used to load a file for internationalization. This is fine but I want the customProperties file name to be dynamic from action class. I am trying to do the following

But it wont load the properties file whose name is stored in the resourceBundle variable in the action class. Any idea how can I set the fileName from action class to this tag?
subject: Getting dynamically
Similar Threads
Resourcebundle can not be found!
Customized error messages for validateLength
Unable to get data from global resource using key attribute
Receiving error while starting application