This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Struts and the fly likes Questions About Resource Bundles Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Questions About Resource Bundles" Watch "Questions About Resource Bundles" New topic
Author

Questions About Resource Bundles

Elle Atechsy
Ranch Hand

Joined: Jan 23, 2004
Posts: 96
Hi,

I'm very new to Struts,as well as converting a Java MVC structured app into the Struts framework. And,in doing so, I am trying to convert a constants properties file into a messageResourceBundle file. My question is...

How do I access the attributes in the resource file from a class file? Or am I just down right off the mark, and cannot use the resource file that way?

It works when displaying a message from the resource file in a JSP page, but I can't figure out how to do it in a class file.

I appreciate any help.

Thanks,
Lulu
sreenath reddy
Ranch Hand

Joined: Sep 21, 2003
Posts: 415
Hi

U can use the java.util.ResourceBundle will do the job for u ........but ofcourse if u want to access the resourcebundles of the struts ....it has a class named MessageResources which internally does the same job as java.util.ResourceBundle
Elle Atechsy
Ranch Hand

Joined: Jan 23, 2004
Posts: 96
Thank you! It's working.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Questions About Resource Bundles