aspose file tools
The moose likes Struts and the fly likes Is it possible to display javascript alerts with s:text tag by picking values from a resource bundle Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Is it possible to display javascript alerts with s:text tag by picking values from a resource bundle" Watch "Is it possible to display javascript alerts with s:text tag by picking values from a resource bundle" New topic
Author

Is it possible to display javascript alerts with s:text tag by picking values from a resource bundle

aman thind
Ranch Hand

Joined: Jun 29, 2007
Posts: 71
I want to display a javascript alert. But i want to use a resource bundle where i've stored key/values of different alert strings. Is it possible that i can pick up those values by using s:text tag in my JAVASCRIPT file?


Aman Thind
SCJP,SCWCD
JAVA utte mar JAVA,mit JAVA
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Only if your JavaScript file is processed through the normal JSP flow. Why not pass in the message to the JavaScript?
aman thind
Ranch Hand

Joined: Jun 29, 2007
Posts: 71
David Newton wrote: Why not pass in the message to the JavaScript?

I am not sure what you are asking:( Are you asking why i am not displaying it directly in the Javascript? I want to display alert messages depending upon user locale. That's why i need my js file to pick up different resource bundles depending upon the locale to display alerts in different languages.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

No, I'm saying "pass in the resource to the JavaScript function (that does the alert)". Your other option is to process your JavaScript files through the JSP processor. Or build localized JS files during the build process. Or create a global message map during build. Or... you get the idea.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Is it possible to display javascript alerts with s:text tag by picking values from a resource bundle
 
Similar Threads
Using more than 1 properties file with Action Form
Session invalidation - getModel called from JSP?
Struts 2: How do you display currency in a textfield?
s:text issue Struts 2
Servlet can't get the xmlhttp post request