• 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

Using JSTL fmt to localize, can I access message bundle from Java class?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible to access the message bundles from within a Java class (not from a jsp page)?
 
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
The JSTL fmt classes are built using the exact same facilities that you'd use in your code. So, yes you can set up your bundles to be accesbile by both Java code and JSTL.
[ March 22, 2007: Message edited by: Bear Bibeault ]
 
Timothy Chan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:
The JSTL fmt classes are built using the exact same facilities that you'd use in your code. So, yes.




For example, from my jsp page, I have:


From a POJO, how do I retrieve the Spanish translation of the mypage.mygreeting key in the message bundles. For instance, I want to retrieve the Spanish version from messages_es.properties.

[ March 22, 2007: Message edited by: timothy chan ]
[ March 22, 2007: Message edited by: timothy chan ]
 
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
That's not a JSP topic, but I suggest you research the classes such as PropertyBundle in the java.util packages.
[ March 22, 2007: Message edited by: Bear Bibeault ]
reply
    Bookmark Topic Watch Topic
  • New Topic