wood burning stoves 2.0*
The moose likes Struts and the fly likes Javascript with Struts 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Javascript with Struts 2 " Watch "Javascript with Struts 2 " New topic
Author

Javascript with Struts 2

Harimohan Mohan
Greenhorn

Joined: Dec 07, 2008
Posts: 6
Hi,

How to access struts 2 given tags using javascript?
I tried to access the following tag
<s:url id="getTsk" action="axnTskPlnr" method="updtTsk"></s:url>
This is my javascript statement to access the above tag
document.getElementById('getTsk')
But it was giving "Object required" script error. Actually i wanted to dynamically change the method attribute.

It would be greatly appreciated if any one can give a pointer to the solution.



Harimohan
[ December 24, 2008: Message edited by: InSilico ]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

All the <s:url...> tag does is create a URL--it doesn't render anything. The "id" attribute specifies the variable n which the URL will be stored--this is on the *server* side.

Also, the JavaRanch rules state that you must use a real name: http://www.javaranch.com/name.jsp
[ December 24, 2008: Message edited by: David Newton ]
paddy Mahadeva Iyer
Ranch Hand

Joined: Feb 10, 2007
Posts: 63
Hi,

I think that would not work. Since the will not render anything in the client side. May be if you want to do a get element by Id you cant try declaring the then access it in a hidden tag . Then in your javascript call the id of the hidden tag.

I think that should work and you should get the actual url.
 
Don't get me started about those stupid light bulbs.
 
subject: Javascript with Struts 2
 
Similar Threads
Calling Action method using struts-tags
how to set javascript varibale in <s:url><s:param> value attribute
equivalent of html:rewrite in struts2
onclick event on autocompleter tag not working
ParametersInterceptor doesn't understand my parameters