This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamic radio button problem

 
parsinglord jain
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 213
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic