
hi.. the code below here there are list of radio buttons here in jsp page when the values are matched from database. I want to pass the selected value in Struts Action FormBean
and then retrive data to perform operation in execute() method in
Struts Action
please help me..
<form action="status.do">
<% while(rs.next()){%>
<tr>
\
<td width="42"><label>
<input name="radiobutton" type="radio" value="radiobutton" />
</label></td>
<td width="350"><input type="hidden" name="hidden"><font color="white" size="5"><%=rs.getString("vid")%></font></td>
<td width="350"><input type="hidden" name="hidden2"><font color="white" size="5"><%=rs.getString("source")%></font></td>
<td width="350"><input type="hidden" name="hidden3"><font color="white" size="5"><%=rs.getString("destination")%></font></td>
<td width="350"><input type="hidden" name="hidden4"><font color="white" size="5"><%=rs.getString("vname")%></font></td>
</tr>
<%}%>
<tr><br><br></tr>
<tr>
<td><center><input type="submit" name="BOOK TICKET" value="BOOK"></center></td></tr>
</form>

Hi Friend,
You have to keep the name attribute same for all radio buttons and you have to use the value attribute also.
Try the following code:
1)radio.html:
<html> <form method="post" action="http://localhost:8080/examples/jsp/radiobuttonvalue.jsp"> Are you a student? <input type="radio" name="sel" value="yes">Yes<input type="radio" name="sel" value="no">No <input type="submit" value="submit"> </form>
2)radiobuttonvalue.jsp
<% String selectedValue=request.getParameter("sel");
out.println(selectedValue);
%>
Thanks

Hi Friend,
You have to keep the name attribute same for all radio buttons and you have to use the value attribute also.
Try the following code:
1)radio.html:
<html> <form method="post" action="http://localhost:8080/examples/jsp/radiobuttonvalue.jsp"> Are you a student? <input type="radio" name="sel" value="yes">Yes<input type="radio" name="sel" value="no">No <input type="submit" value="submit"> </form>
2)radiobuttonvalue.jsp
<% String selectedValue=request.getParameter("sel");
out.println(selectedValue);
%>
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.