Hi,
I have a parent child relationship to implement.
I have successfully implemented the code to create such a Campaign instance that contains dynamic no of campaignField instances.Code:public class Campaign { private List<CampaignField> fields = new ArrayList<CampaignField>(); //.....Some other fields and getter setter method. } public class CampaignField{ private String description; //.....Some other fields and getter setter method. }
However when I load one of the Campaign instance from my controller and try to add/delete few of the campaign field children into the parent campaign instance and then click on update button, I always get the previous no of campaign field children, not the newly updated children.
In other words, If my initial parent campaign object contained 3 campaign fields and in my update screen I deleted one of the three children and clicked on update button, I get 3 campaign fields instead of desired 2 campaign fields.
Please let me know what I am doing wrong.
Here is the code that binds the campaign
ThanksCode:<table id="campaignFieldsTable" class="ui-widget ui-widget-content"> <thead> <tr class="ui-widget-header"> <th>Description</th> </tr> </thead> <tbody> <core:forEach items="${fields}" varStatus="fieldRow"> <tr> <td> <spring-tags:bind path="fields[${fieldRow.index}].description"> <input type="text" name="<core:out value="${status.expression}"/>" id="<core:out value="${status.expression}"/>" value="<core:out value="${status.value}"/>"/> </spring-tags:bind> </td> </tr> </core:forEach> </tbody> </table>
Ahsan


Reply With Quote