You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Paweł Wielgus <po...@gmail.com> on 2009/07/30 14:27:09 UTC

Re: How to pass "id" to any method by means of and submit button?

Hi bilgerkan,
have You check the generated source of that page,
is it ok in the HTML sense?
Do you have editInvoice long table defined in a Form that is aplied to
invoiceEdit action?

Best greetings,
Paweł Wielgus.


2009/7/30 bilgerkan <bi...@yahoo.com>:
>
> Hello,
>
> I'm new on struts and want to handle following problem:
>
> I am listing all the invoice items via <logic:iterate> in my
> invoiceList.jsp. Beside each invoice line, there is a checkbox, which I want
> to use as following: User clicks on any checkbox to select the appropriate
> invoice item beside it, and after clicking on the submit button at the
> bottom, the id of the selected invoice shoould be transferred to
> InvoiceEditAction.editInvoice() method.
>
> But I get following error message unfortunately:
> javax.servlet.ServletException: java.lang.NumberFormatException: For input
> string: ""
> So I think the id can not be transferred at all.
>
> 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>
>
> --
> View this message in context: http://www.nabble.com/How-to-pass-%22id%22-to-any-method-by-means-of-%3Cinput-type%3D%22checkbox%22%3E-and-submit-button--tp24733742p24733742.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org