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

Is resource bundle file used often?

Tony Smith
Ranch Hand

Joined: Jul 07, 2007
Posts: 229
I know resource bundle file is definitely useful for internationalization. But is it a good practice to use it under normal struts application? Seems to me it's easier to just type in the text on the spot instead of having it replaced by resource bundle property file.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Most books you read on Struts will recommend as a best practice that you use the Resource Bundle for all literal text. However, you're right: it is a pain in the neck to have to extract every little bit of text you want to use into a properties file. I find myself working on projects where the client has not asked for internationalization, and probably won't any time in the near future. In such a case I normally just put the literal text in the JSP. Should I use the properties file instead? Probably... but then I should floss every day, and I don't do that either.

Consultant, Sima Solutions
Eugene Abarquez
Ranch Hand

Joined: May 18, 2006
Posts: 211
I agree, although it is often recommended in most books that you should externalize all of your strings in the resource bundle, I think it is good that you only do it when it is needed. I have seen some applications before wherein resource bundles have been overused, using them even though internationalization isn't really a requirement. And doesn't using resource bundles increase the overhead, as it stills loads the properties file?

There's so much to learn in this industry, and not everybody has the necessary interest.
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
You don't floss everyday?!?!

Resource bundles are also handy for keeping the label shown on the screen in sync with the label shown in validation messages. Having all strings in one place can also be handy if you need to change the same word and it appears in several pages (much easier than searching through your JSP files) and to some extent it can help out with spell checking.

- Brent
I agree. Here's the link:
subject: Is resource bundle file used often?
It's not a secret anymore!