Hello, I am trying to pick up the changes made to a collection on a submitted form. The collection created looks like the following:
<logic:iterate id="secGrp" name="selRptSpec" property="rptSpecAsgn" indexId="keyValue" >
<td><html:checkbox indexed="true" name="secGrp" property="checked" />
<bean:write name="secGrp" property="displayVal" />
<td><html:text indexed="true" name="secGrp" property="description" size="55" maxlength="100" />
<td><html:text indexed="true" name="secGrp" property="appValue" size="3" maxlength="3" />
"rptSpecAsgn" is an ArrayList of assignment objects. The assignment class has getters and setters for each of the member variables. In my action form I have code for reseting the collection as well as the getter and setter methods.
All standalone fields on the form are submitted and mapped to thier corresponding variables in the actionForm class with the exception of the rptSpecAsgn collection. I can set the values for each item in the collection and they are displayed correctly in the JSP, but when I submit the form the collection returns empty.
I am not sure what I am doing wrong here, but I have aged 10 fold getting this to work. Any assistance would be greatly appreciated.
I guess if you are reseting collectionin the reset method then it is being called after the form submit...This will happen if you are trying to call soem other method in the same action on submit.
I had similar problem to overcoem this I had to create my own reset method which i call from action only when needed.
Hope this helps
Thanks for the quick response. I removed any code associated with the collection from the reset method and still no luck. ???
Try to create a hidden property for this collectionin the form and see if it submits.
I am not sure what you mean. I tried to create
<html:hidden property="rptSpecAsgn" />
and when I accessed the page I recieved the following exception:
java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Not sue why you have that exception.It should have worked if you have commented reset method lines and have html:form tag properly embedding your required feilds within it on the jsp...If you won't mind you post your jsp here.
I am facing the same problem. Did you find any solution for this????
Solution for this problem is clearly defined athttp://www.developer.com/java/ejb/article.php/2233591
go and check it. May contact me at jpe123in at yahoo dot com for clarifications.
Not sure what the difference is yet but i ran into this problem today when upgrading to j2sdk1.4 from 1.3. After reading another forum somebody suggested that a difference in reflection API between 1.3 and 1.4 is causing this. changing the ArrayList in the form to be an Object fixed the issue.