I have a VO object which contains string + a map property. This object is forming a list and then I am trying to use display:table to display this list. For all string properties display:column is fine but for the map code using display:column is becoming difficult as the key of the map forms the header which has to be displayed only once as the title of the last display:column and the values will have to iterate. I saw two options of either using display:table within display:column or iterate the map. But with display:table within column I could see the title as static (which is not in my case).
The code without display:table
<table id="prepaid" width="1120px" style="margin-left: 20px; border: 1px solid #7591AC;" cellSpacing=1 cellPadding=0 class=tabular>
<logic:present name="provisioningStatisticsResultList">
<logic:iterate id="provisioningStatisticsResultListObj" name="provisioningStatisticsResultList" indexId="index">
<bean:define id="mapEntry" name="provisioningStatisticsResultListObj" property="rangeMap" />
<tr>
<logic:equal name="index" value="0">
<th><bean:message key="label.applicationId" bundle="labels" /></th>
<th><bean:message key="label.version" bundle="labels" /></th>
<th><bean:message key="label.results" bundle="labels" /></th>
<logic:iterate id="map" name="mapEntry">
<th><bean:write name="map" property="key" /></th>
</logic:iterate>
</logic:equal>
</tr>
<tr class="tableRowEven">
<td class="td.iconCell"><bean:write name="provisioningStatisticsResultListObj" property="applicationId" /></td>
<td><bean:write name="provisioningStatisticsResultListObj" property="apkVersion" /></td>
<td><bean:write name="provisioningStatisticsResultListObj" property="activationType" /></td>
<td><bean:write name="provisioningStatisticsResultListObj" property="status" /></td>
<logic:iterate id="map" name="mapEntry">
<td><bean:write name="map" property="value" /></td>
</logic:iterate>
</tr>
</logic:iterate>
</logic:present>
</table>
With display:table I tried various options but nothing works, may be some syntatical error or another solution all together (commented one):
<display:table name="sessionScope.provisioningStatisticsResultList"
id="provisioningStatisticsResultListObj" defaultsort="1" defaultorder="ascending"
pagesize="<%= recordsPerPage %>" cellspacing="0" cellpadding="3"
requestURI="/provisioningStatistics.do" export="true"
class="data_table width_full" style="margin-left:20px;">
<display:column title="Application ID">
<bean:write name="provisioningStatisticsResultListObj" property="applicationId"/>
</display:column>
<display:column title="Version">
<bean:write name="provisioningStatisticsResultListObj" property="apkVersion"/>
</display:column>
<display:column title="Results">
<bean:write name="provisioningStatisticsResultListObj" property="status"/>
</display:column>
<bean:define id="mapEntry" name="provisioningStatisticsResultListObj" property="rangeMap" />
<logic:iterate id="map" name="mapEntry">
<display:column title="<bean:write name="map" property="key" />">
<bean:write name="map" property="value" /></display:column>
</logic:iterate>
<%-- <display:column property="rangeMap">
<display:table id="mapEntry" name="rangeMap" style="margin-left:20px;">
<display:column title = "<bean:write name="map" property="key" />" >
<bean:write name="map" property="value" />
</display:column>
</display:table>
</display:column> --%>
<%-- <logic:iterate id="map" name="mapEntry" property="rangeMap" indexId="index1">
<display:column title = "<bean:write name="map" property="key" />" >
<bean:write name="map" property="value" />
</display:column>
</logic:iterate> --%>
</display:table>
</tbody>
</table>
</logic:present>
My project using struts 1. Please help me correct the code
You need to include the tag library that has the display
tag defined:
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
Also, make sure the jar file displayTag.jar is in your classpath.