This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
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 Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Javascript with Struts 2 " Watch "Javascript with Struts 2 " New topic

Javascript with Struts 2

Harimohan Mohan

Joined: Dec 07, 2008
Posts: 6

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
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.

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

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:
[ December 24, 2008: Message edited by: David Newton ]
paddy Mahadeva Iyer
Ranch Hand

Joined: Feb 10, 2007
Posts: 63

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.
subject: Javascript with Struts 2