Hello all,
I have the following jsp page that populates a table and inserts a radio button (one per row). Upon form submission the value of the selected radio button, which represents an index, is correctly passed to the form baking object, everything works just fine. Here is the jsp:
What I want to do is eliminate both the radio button and the submit button at bottom of the page, and have one submit button per row. This way the user will only need one click to pass the value of the index to the form backing object. Here is more code with comments for clarity:Code:<table width="1000" bgcolor="f8f8ff" border="2" cellspacing="0" cellpadding="5" align ="center"> <form:form method="post" commandName="scriptFill"> <tr> <td align="center" width="30%">Filename</td> <td align="center" width="30%">Description</i></td> <td align="center" width="30%">Name</td> <td align="center" width="10%">Select</td> </tr> <c:forEach items="${myList}" var="script"> <tr> <td align="left" width="30%"><c:out value="${script.fileName}"/></td> <td align="left" width="30%"><i><c:out value="${script.description}"/></i></td> <td align="left" width="30%"><i><c:out value="${script.name}"/></i></td> <td align="center" width="10%"><form:radiobutton path="index" value="${script.index}" label="" ></form:radiobutton></td> </tr> </c:forEach> </table> <center> <i><input type="submit" align="center" value="Populate" ></i> </center> </form:form>
Code:<table width="1000" bgcolor="f8f8ff" border="2" cellspacing="0" cellpadding="5" align ="center"> <form:form method="post" commandName="scriptFill"> <tr> <td align="center" width="30%">Filename</td> <td align="center" width="30%">Description</i></td> <td align="center" width="30%">Name</td> <td align="center" width="10%">Select</td> </tr> <c:forEach items="${myList}" var="script"> <tr> <td align="left" width="30%"><c:out value="${script.fileName}"/></td> <td align="left" width="30%"><i><c:out value="${script.description}"/></i></td> <td align="left" width="30%"><i><c:out value="${script.name}"/></i></td> <%-- ELIMINATE THE RADIO BUTTON <td align="center" width="10%"><form:radiobutton path="index" value="${script.index}" label="" ></form:radiobutton></td> --%> <%-- HAVE A SUBMIT BUTTON THAT PASSES THE RIGHT VALUE OF script.index TO THE INDEX VALUE OF THE FORM BACKING OBJECT <td align="center" width="10%> <input type="submit" align="center" value="Goto" ></i> </td> --%> </td> </c:forEach> </table> <center> <%-- ELIMINATE THIS SUBMIT BUTTON <i><input type="submit" align="center" value="Populate" ></i> --%> </center> </form:form>
I'm also including images to make things more clear. I want to go from this:
Screen shot-1.jpg
to this:
Screen shot-2.jpg
Please let me know if you have further questions, I might not have been clear.
Thank you in advance!


Reply With Quote
