aspose file tools*
The moose likes Struts and the fly likes how to invoke method based on radio button select Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to invoke method based on radio button select " Watch "how to invoke method based on radio button select " New topic
Author

how to invoke method based on radio button select

sahithi mohan
Greenhorn

Joined: Feb 13, 2012
Posts: 9
Hi ,

In JSP , two radio buttons are there. In action class have two methods .if select first radio button ,then submit it, it has to execute first method. if select second radio button ,it has to execute second method.

I wrote code in JSP,


how to write in strut.xml and action class in strut 2
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

I didn't know what you are doing in the method's as per my understanding here we can solve it in two ways
1) Identify which radio button is selected in your action call and do process appropriately.
2) write two action classes and Identify which action to be called depending on radio button using javascript.


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
sahithi mohan
Greenhorn

Joined: Feb 13, 2012
Posts: 9


Consider First one, By using java script I can identify the which radio button i selected.suppose i selected save radio button.In java script ,using get value of that button.hence how to proceed . how do i call method

Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

sahithi mohan
Greenhorn

Joined: Feb 13, 2012
Posts: 9

Thax Mohan Rao. I knew that way .I need to use single action class ,it contains two method . it has call based on radio selected. how do i implement.
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

So, you are calling same action class whatever the radio button was selected then you must know that is the which radio button was selected in the action class. Based on the condition call the appropriate action. I hope this helps.
sahithi mohan
Greenhorn

Joined: Feb 13, 2012
Posts: 9
Thanks Mohan Rao.
 
wood burning stoves
 
subject: how to invoke method based on radio button select