• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Internationalization

 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
Looking for some "best Practices" advice here. I have a properties file which I have some text messages defined in, for example, I have a String called "Select One" which I put as the first entry of several select box's. My question is this, right now, everytime I load the list of items for the select list, I open the properties file to get the value of the first item string "Select One" . Is this wrong to go fetch it every time, should I just fetch the string from the properties file once and store it in memory along with other similar strings I need for the application? I know how to load the property file and get the string values I need, just not sure if I should be only doing this once when the app starts up and storing the strings in an object, or just fetching them again and again as they are needed.
Thanks much for any opinions,
Kim
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should investigate the fmt class of tags from the JSTL and use a standardized approach.
 
Kim Kantola
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could I bother you to give me your opinion of the best way to do this without JSTL ? Thank you for taking the time to reply.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You asked for best practices; that means the JSTL. Why are you reluctant to use it?
 
Kim Kantola
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just the usual, short on time, and I know how to get strings from a properties file, which seems like the way many people handle this situation. I wasn't really looking for a differant way to handle internationalization, I was more looking for a best practices on how to handle string values from a properties file, either :

Get them once and store in memory

or

Get them as I need them each time the jsp page is requested.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Kim Kantola:
which seems like the way many people handle this situation.



Again, you asked for best practices, not what most people hack into their code.

If you are not going to use best practices, then I'd recommend that you at least use the properties and property bundle handling classes from the java.util package and let it handle any caching.
 
reply
    Bookmark Topic Watch Topic
  • New Topic