Reputation: 503
ok here is the scenario i have two pojo classes they are as follows
public class CodeSetting {
private long codeSettingId;
private String code;
private String codeDescription;
private CodeType codeType;
private Collection<Company> company = new ArrayList<Company>();
}
public class Company
{
private String comapny Name;
}
now i want to display the codesetting using the display tag codesetting and company have many to many relationship ok.
so using display tag i can display the attributes of the codesetting by using a list of code setting object.
but the problem comes while displaying the company
as its also a collection it also needs to be iterated for each codesetting object but not possible using display tag tried using the iterator tag of struts2 but still no use
i want my display to be like this
code codetype company
M marriage abc,bca
if anyone came across the scenario and solved the problem do guide me through it would be very helpful .thanks in advance
Upvotes: 1
Views: 4518
Reputation: 503
finally got the answer need to use nested column in display tag only problem is while exporting as we are using nested sub list
<display:table id="parent" name="codesettingList" cellpadding="7" cellspacing="5" pagesize="5" requestURI="/viewCodeSetting" >
<display:column property="codeSettingId" title="Code Setting ID" href="viewCodeSettingSelected" paramId="codeSettingId"/>
<display:column property="code" title="Code"/>
<display:column property="codeDescription" title="Code Description"/>
<display:column property="codeType.codeType" title="Code Type" />
<c:set var="nestedName" value="codesettingList[${parent_rowNum -1}].company" />
<display:column title="Company">
<display:table name="${nestedName}" id="child${parent_rowNum}" class="simple sublist">
<display:column property="companyName" ></display:column>
</display:table>
</display:column>
<display:setProperty name="paging.banner.placement" value="bottom" />
</display:table>
Upvotes: 1