resource bundles...

P

pojo

I want to improve my code using resource bundles. I have fields like
no: of companies
no: of places..etc.,
I want to use resource bundles and put the key value pair like

No: of comapanies = 12
no: of places = 50 ..etc., in a file and use the keys whenever i have
to use the values.

can someone walk me through this...with details like..
what should be the file name for these fields..
where should I put the file name...
what changes hould I make to the config files...etc.,

I am not using struts.
I am using JBoss and Intellij IDEA.

thanks,
 
R

Rhino

pojo said:
I want to improve my code using resource bundles. I have fields like
no: of companies
no: of places..etc.,
I want to use resource bundles and put the key value pair like

No: of comapanies = 12
no: of places = 50 ..etc., in a file and use the keys whenever i have
to use the values.

can someone walk me through this...with details like..
what should be the file name for these fields..
where should I put the file name...
what changes hould I make to the config files...etc.,

I am not using struts.
I am using JBoss and Intellij IDEA.
I'm not sure if you really need to use resource bundles for the data that
you describe; it sounds to me like you'd be fine just using regular
Properties files. Storing your data in Preferences nodes or in a database
may also be good approaches.

However, if you are sure that those other options are inappropriate, I think
you will find that the Internationalization "trail" (chapter) in the Java
Tutorial covers this topic pretty well. You can find it at
http://java.sun.com/docs/books/tutorial/i18n/index.html.

I've only tried using ResourceBundles with applications and applets so I'm
not sure if servlets or JBoss or IDEA add any complications; the exact
placement of the ResourceBundles may differ in those environments. Someone
else may be able to tell you about that.

The tutorial will explain that you can use ResourceBundles to store
information in key-value pairs in both Message and Text bundles; the Text
bundles are the closest to what you want; they are structured just like
Properties files but give you the option of having multiple concurrent
versions of your text in different languages so that your applications can
support multiple languages with minimum of effort.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top