wood burning stoves*
The moose likes Struts and the fly likes Dynamic radio button problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Dynamic radio button problem" Watch "Dynamic radio button problem" New topic
Author

Dynamic radio button problem

parsinglord jain
Greenhorn

Joined: Aug 13, 2010
Posts: 3
Hi,

I generate dynamic single radio button in <s:iterator> . how will i know which radio button was clicked....code is given below



Now i want to know which radio button was clicked.....because this one only gives me one value...
Richard Golebiowski
Ranch Hand

Joined: May 05, 2010
Posts: 213

It's not clear by your code what you are trying to accomplish.

The way you would do a radio button from a list is like this.:

In my action form I have:



In my jsp I have:



The returned value is contained in searchSpecResult so searchSpecResult would return One, Two, or Three depending on what was selected. That is how you know what button is pressed

In your code it looks like you are trying to do a group of radio buttons in every loop in your iterator. If that is what you are trying to do then you will need to have the value in the name attribute be a unique field name for each group of buttons.
So if addpayer is a collection for the returned value, you should set the radio button like this:
Nirakar Mohanty
Greenhorn

Joined: Mar 28, 2011
Posts: 2
parsinglord jain wrote:Hi,

I generate dynamic single radio button in <s:iterator> . how will i know which radio button was clicked....code is given below



Now i want to know which radio button was clicked.....because this one only gives me one value...


Hi ,
I have similary type issue . I want to generate two radio button ( YES /NO) inside one iterator.
And depending upon some condition i have to check one .. COuld you please help me in this
 
Don't get me started about those stupid light bulbs.
 
subject: Dynamic radio button problem
 
Similar Threads
Struts2 test condition in s:if not working
Update Database with the newly entered value
s:radio and display tag
A diffrent type of checkbox problem
s:iterator question