• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

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: 67750
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: 67750
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 ]
 
I love a good mentalist. And so does this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic