• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Javascript with Struts 2

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic