Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

accesing multiple radio buttons with different names in a JSP

843836Aug 2 2003 — edited Aug 13 2003
Hi

I have a JSP which displays a table. In each row of the table there are 2 radio buttons. Now when user submits the form, i want to access the values of all the radio buttons. The radio buttons in each row are named differently. Will i have to have a separate parameter to access value of radio button in each row ? Or can i collect all values into a vector ?

Following is my JSP

<FORM ACTION="/examples/servlet/TestServlet">
<TABLE border=1>
<TR>
<TD>Leave Id </TD>
<TD>Status </TD>
</TR>
<%
Vector leave_ids = (Vector)request.getAttribute("leave_ids");

int leaveid = 0;

for(int i =0; i < leave_ids.size();i++)
{
leaveid = Integer.parseInt(leave_ids.elementAt(i));

%>

<TR>
<TD><%=leaveid%></TD>
<TD>
<P>
<INPUT id=radio type=radio name=radio<%=i%>>&nbsp;Accept
<INPUT id=radio type=radio name=radio<%=i%>>&nbsp;Reject

</P>
</TD>
</TR>
<%
}
%>
</TABLE>

<DIV ALIGN="CENTER">
<INPUT NAME="" TYPE="submit" value="Submit">
</DIV>
</FORM>

In my other JSP will i have to do request.getParameter("radioi") for each i ?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 10 2003
Added on Aug 2 2003
2 comments
230 views