File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes bean  taglib  inside javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "bean  taglib  inside javascript" Watch "bean  taglib  inside javascript" New topic

bean taglib inside javascript

sudin prans

Joined: Sep 02, 2005
Posts: 4

var labelTxt = "changingValues"
labelTxt = '<bean:message key="labelTxt">'


My javscript function has the above statements.
the variable labelTxt can have different values,these will be the keys in the property file,so depending on the variable the correct keyvalue should be fetched.
But if I give as above ,it is searching for the key labelTxt in my property file.
Pls help.
Thnks in advance.
Choon-Chern Lim
Ranch Hand

Joined: Aug 29, 2005
Posts: 74
Sure... but make sure your javascript is sitting in jsp file instead of a js file.

Try this in your jsp:-
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

Also, don't forget to close the bean:message tag!

A good workman is known by his tools.
sudin prans

Joined: Sep 02, 2005
Posts: 4
Sorry ..its not working still..its still the same.I think I wont get the client side javascript value in the jsp attribute.
I agree. Here's the link:
subject: bean taglib inside javascript
It's not a secret anymore!