This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP and Radio Buttons

 
Marylou Thompson
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSP with a select box,radio buttons, and a submit button. The user will make a select from the select box and click on one of the radio button. When the submit button is clicked on the JSP redirects to another JSP that needs to determine the value from the select box (which works) and determine which radio button is checked. The 2nd JSP saves the value from the select box using request.getParameter(select box name). However, I can't determine which radio button is "on". How should I do this?
 
Vijay S. Rathore
Ranch Hand
Posts: 449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Marylou Thompson,
Give your radio buttons a different name but put them in the same group. e.g
<input type="radio" name="RB" value="rb1">
<input type="radio" name="RB" value="rb2">
<input type="radio" name="RB" value="rb3">
<input type="radio" name="RB" value="rb4">
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic