Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Javascript with Struts 2

 
Harimohan Mohan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic