Reputation: 415
I'm using spring 3.0, in my jsp i have a couple of checkboxes (the normal ones <input type="checkbox" ....>
). I'm using the <spring:bind path="businessL1">
to bind it with the bean with property String[] businessL1;
the checkboxes look something like this (in html) :-
<input type="checkbox" value="2" name="businessL1[]">
Now when every i try to submit the form the following exception is thrown:-
[org.apache.jsp.WEB_002dINF.jsp.error.GenericError_jsp] - Generic Error:
java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:470)
at java.lang.Integer.parseInt(Integer.java:499)
at
org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:938)
at
org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:900)
at........
I'm have no conversions being done, everything is of String type. the controller i'm using is a simple form controller by the way the rest of the properties i.e the non checkbox type like text etc. are being set in the bean successfully.
Upvotes: 1
Views: 1488
Reputation: 242706
As far as I understand, you don't need square brakets to bind checkbox values to String[]
:
<input type="checkbox" value="2" name="businessL1">
Upvotes: 1