Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to pass "id" using input type="checkbox" and submit butt

Status
Not open for further replies.

bilgerkan

Programmer
Aug 7, 2009
1
EU
Hello,

I want to handle following problem:

I am listing all the invoice items via <logic:iterate> in the invoiceList.jsp. In GUI, beside each invoice line, there is a checkbox pointing to this invoice. If the user clicks on a checkbox and afterwards clicks on the submit button, the id of the selected invoice should be transferred to InvoiceEditAction.editInvoice() method.

But I get following error when I do this:

javax.servlet.ServletException: java.lang.NumberFormatException: For input string: ""

I assume that the id is passed as "".

Below you can find my invoiceList.jsp. Any help is appreciated.


<html>
<body>
<html:form action="invoiceEdit">

<table >
<tbody>
<tr>
<td></td>
<td>id</td>
<td>Invoice No</td>
<td>Date</td>
</tr>

<logic:iterate name="invoiceListForm" property="invoices" id="invoice">
<tr>
<td >
<input type="checkbox"
value="<bean:write name="invoice" property="id"/>"
name="editInvoice">
</td>
<td><bean:write name="invoice" property="id" /></td>
<td><bean:write name="invoice" property="invoiceNo" /></td>
<td><bean:write name="invoice" property="date" /></td>
</tr>
</logic:iterate>
</tbody>
</table>

<html:button property="add"
onclick="location.href='invoiceEdit.do?do=addInvoice'">Add a new invoice
</html:button>


<html:button property="back"
onclick="location.href='default.do'">Back to menu
</html:button>


<%-- set the parameter for the dispatch action --%>
<html:hidden property="do" value="editInvoice" />

<html:submit>Update</html:submit>

</html:form>

</body>
</html>



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top