Reputation: 15090
I need to update the list of objects from Page to database. I have an application which is developed using Struts2, tiles, Jquery, Hibernate. I used Custom conversion option in struts2 to convert collection of custom the object type. I used to declare the collection as type ArrayList/ Hasset (tried both declaration). From page, i am setting the value for custom object Properties. below is the HTML which is rendered. it has only one object which is assigned into lstRulemaster(0). I don't know what goes wrong for duplication.
HTML
<tr class="odd">
<td class="locked" style="width:200px">
<input type="hidden" name="lstRulemaster(0).masterDataId" value="2" id="hierarchyUpdateForm_lstRulemaster(0)_masterDataId"/>
<input type="hidden" name="lstRulemaster(0).masterDataCode" value="000000032334307713" id="hierarchyUpdateForm_lstRulemaster(0)_masterDataCode"/>
<input type="hidden" name="lstRulemaster(0).masterDataRuleMapId" value="1" id="hierarchyUpdateForm_lstRulemaster(0)_masterDataRuleMapId"/>
000000032334307713 - MONO E/S
</td>
<td style="width:60px"></td>
</tr>
JSP
<display:table id="data" name="lstEntities"
sort="external" uid="row" htmlId="rowid" class="tborder tborder1"
excludedParams="*" style="width:100%"
pagesize="${pageCriteria.recordsPerPage}" partialList="true"
size="${pageCriteria.totalRecords}" export="false"
requestURI="hierUpdateMDA.action">
<display:column titleKey="${entity.masterDataDesc}" class="locked"
style="width:200px" headerClass="locked">
<s:hidden
name="lstRulemaster(%{#attr.row_rowNum-1}).masterDataId"
value="%{searchAttribute.masterData.id}" />
<s:hidden
name="lstRulemaster(%{#attr.row_rowNum-1}).masterDataCode"
value="%{#attr.row.mastervaluecode}" />
<s:property value="%{#attr.row.mastervaluecode}" /> - <s:property
value="%{#attr.row.mastervaluedescp}" />
</display:column>
My Conversion property file content.
KeyProperty_lstRulemaster=masterDataCode
Element_lstRulemaster=com.cotyww.bru.core.entity.master.RulesMaster
CreateIfNull_lstRulemaster=true
When i print the properties of the object in the collection, it has duplication. Collection size itself double the records available in page. Values are also repeating.
Upvotes: 1
Views: 326
Reputation: 15090
When i changed the syntax from lstRulemaster(%{#attr.row_rowNum-1}).%{referenceColumn}
into lstRulemaster[%{#attr.row_rowNum-1}].%{referenceColumn}
the problem got resolved. I am not sure about what is the real issue. any idea on what is the issue?
Upvotes: 1