Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

How to pass "id" to any method by means of <input type="checkbox"> and submit button?

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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:form action="invoiceEdit">

<table >
<td>Invoice No</td>

<logic:iterate name="invoiceListForm" property="invoices" id="invoice">
<td >
value="<bean:write name="invoice" property="id"/>"
<td><bean:write name="invoice" property="id" /></td>
<td><bean:write name="invoice" property="invoiceNo" /></td>
<td><bean:write name="invoice" property="date" /></td>

<html:button property="add"
onclick="location.href=''">Add a new invoice


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


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





Forget Steve. Look at this tiny ad:
We need your help - Coderanch server fundraiser
    Bookmark Topic Watch Topic
  • New Topic