• Post Reply Bookmark Topic Watch Topic
  • New Topic

how i can access my String resource boundle, from Scriptlets inside a jsp files ?

 
Ramina Nibilian
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi , thank you for reading my post.
I face a problem with internationalizing my application .
I need to read and put some message inside my scriptlets.
You think i defined some String variable in my jsp files via Scriptlets and i need to assign
some keys from my resource boudle to them.
I tried to use , for example


but it returns errors.
Generated servlet error:
Syntax error on token "<", delete this token
......

I use Struts as web application framework.
can you pleas help me with this ?
Thank you so much.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot mix tags and scriplets like that. You need to decide whether you want to use scriptlets or to use tags and stick with that approach.

In my opinion, your best bet would be to eschew scriplets in favor of scriptless pages using a tag-based approach and the JSTL. That way, you could take full advantage of the fmt class of JSTL tags for your internationalization needs.
 
Ramina Nibilian
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
thank you for reply.
you mean there is no way to get some Key from resource files with java code ?
i need to access my resource files from java codes inside a JSP
It not neccessery to access them via TAGs and combine tags with scriptlet in my case.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure, you can do everything in scriptlets if you like, but that's not an approach I can recommend.

You will find the classes to handle resource bundles in the java.util package.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!