Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Timothy Chan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to access the message bundles from within a Java class (not from a jsp page)?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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 ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!