File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes MessageResources VS ResourceBundle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "MessageResources VS ResourceBundle" Watch "MessageResources VS ResourceBundle" New topic

MessageResources VS ResourceBundle

Dan Howard
Ranch Hand

Joined: Feb 22, 2004
Posts: 47
Hi All,

For building apps using internationalization I can use MessageResources in struts but it's likely that parts of my app which may require translation are not really in the web layer. For example console utilities and Swing.

So I'm thinking of not using MessageResources and instead use ResourceBundle since it's a common class in java.util.

Are any major disadvantages in using ResourceBundle over MessageResources?

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The biggest disadvantage would be that you would be unable to use ActionMessages for validation unless you use MessageResources.

Consultant, Sima Solutions
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
Presentation tier - Struts part of application

Business tier- POJO or EJB Business model part of application

Integration tier - Relational Database, Web Services, File system, EIS

Are any major disadvantages in using ResourceBundle over MessageResources?

Use both. Struts is only for the View and Controller portion of a MVC-based application. So, org.apache.struts.util.MessageResources should be used only in the Presentation tier (in the web interface component)

Use a ResourceBundle for language translation needs in the Model, aka business application.

P.S. No business logic goes in the Struts Action subclasses.
[ July 09, 2008: Message edited by: James Clark ]
I agree. Here's the link:
subject: MessageResources VS ResourceBundle
It's not a secret anymore!