This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts with javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts with javascript" Watch "Struts with javascript" New topic
Author

Struts with javascript

piyush kumar
Greenhorn

Joined: Feb 01, 2007
Posts: 20
Hi all,
i have one jsp which is called viewserver.jsp and viewaction class, now what i am doing is ion my jsp there are some radio buttons and corresponding values of the radio button. now when i click on the radio button iot calls a javascript function serverid(this.form, this.value) in which i am passing the form and the corresponding value which is clicked . now i want that this value should be transffered to my Action class which uis viewaction for furthur processing. c an anybody tell me how to transfer the single value to the action class.
thanks in advance
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Why not just submit the form? Then the action class can just read the value from the request.

If you want to communicate with the Action without submitting the form, you will have to use an AJAX call.


Merrill
Consultant, Sima Solutions
John Simpson
Greenhorn

Joined: Sep 10, 2007
Posts: 25
To further elaborate on Merrill's point,

Make sure that you have an id for the element, and also make sure that the ActionForm of your jsp has corresponding setters/getters for the parameter of that id.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Struts with javascript
 
Similar Threads
Radio Buttons
Getting html form name
loosing fielderror when result to another action
form bean value not getting
Struts 1.1: html:radio issues