Announcement Announcement Module
Collapse
No announcement yet.
Binding String[] Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Binding String[]

    im trying to add an array of strings to an object. i have String[] qty in my class.but there seems to be an error here:

    Code:
    <c:forEach items="${menulist}" var="emp">
    						<tr>
    							<td>${emp.name}</td>
    							<td><form:input id="qty" path="qty[${emp.num}]" size="4" maxlength="4" value="0"/></td>
    							<td><form:errors path="qty[${emp.num}]" cssClass="error"/></td>	
    						</tr>
    					</c:forEach>
    'cause when im submitting the form, it has this error:

    org.springframework.beans.InvalidPropertyException : Invalid property 'qty[0]' of bean class [CyberSous.Model.Sales]: Invalid array index in property path 'qty[0]'; nested exception is java.lang.ArrayIndexOutOfBoundsException

    seems like the form does not bind the input to qty[]

    can anyone help me? it's kind of urgent and not really used to using spring
Working...
X