如何在JSP上使用display标记显示嵌套数组列表?
我有两个数组列表。员工名单和分配名单 每个员工都有分配列表如何在JSP上使用display标记显示嵌套数组列表?,jsp,displaytag,Jsp,Displaytag,我有两个数组列表。员工名单和分配名单 每个员工都有分配列表 Employeeclass如下所示 public class Employee { private int id; private String firstname; private String lastname; private List<Allocation> allocationList ; // geters and setters } 假设我们有三个分配
Employee
class如下所示
public class Employee {
private int id;
private String firstname;
private String lastname;
private List<Allocation> allocationList ;
// geters and setters
}
假设我们有三个分配类别,分别命名为X、Y和Z
每个员工都将拥有这些类别的相应值
雇员埃里克有X=10、Y=20和Z=67,以此类推
如何使用显示标签显示员工详细信息以及下图所示的每个员工的分配
我不想使用display标记的嵌套表功能,该功能允许显示嵌套列表,因为嵌套列表不会在display标记中导出 好的。所以我自己想出来了。下面是工作代码
<display:table name="employeeList" pagesize="25" class="listingTable" keepStatus="true" cellpadding="0px"
cellspacing="0px" id="employee" export="true" requestURI="">
<display:setProperty name="export.decorated" value="true" />
<display:setProperty name="export.excel.filename" value="${exportFileName}.xls" />
<c:forEach var="cl" items="${selectedColumnList}">
<display:column property="${cl.property}" title="${cl.title}" format="${cl.format}" />
</c:forEach>
<c:forEach var="allocationCl" items="${allocationCategoryList}" varStatus="status">
<c:set var="allocationCounter" value="${status.index}" />
<display:column title="${allocationCl.category}">
<c:choose>
<c:when test="${fn:length(employee.allocations) ne '0' }">
${employee.allocations[allocationCounter].allocation}
</c:when>
<c:otherwise>
0
</c:otherwise>
</c:choose>
</display:column>
</c:forEach>
<display:setProperty name="paging.banner.item_name" value="Employee" />
<display:setProperty name="paging.banner.items_name" value="Employees" />
</display:table>
${employee.allocations[allocationCounter].allocations}
0
这是否可以在显示标签中完成,或者我必须找到其他方法来完成?我正在使用显示标签,因为我需要使用显示标签的导出功能。否则,我必须手动进行导出。请帮忙。
<display:table name="employeeList" pagesize="25" class="listingTable" keepStatus="true" cellpadding="0px"
cellspacing="0px" id="employee" export="true" requestURI="">
<display:setProperty name="export.decorated" value="true" />
<display:setProperty name="export.excel.filename" value="${exportFileName}.xls" />
<c:forEach var="cl" items="${selectedColumnList}">
<display:column property="${cl.property}" title="${cl.title}" format="${cl.format}" />
</c:forEach>
<c:forEach var="allocationCl" items="${allocationCategoryList}" varStatus="status">
<c:set var="allocationCounter" value="${status.index}" />
<display:column title="${allocationCl.category}">
<c:choose>
<c:when test="${fn:length(employee.allocations) ne '0' }">
${employee.allocations[allocationCounter].allocation}
</c:when>
<c:otherwise>
0
</c:otherwise>
</c:choose>
</display:column>
</c:forEach>
<display:setProperty name="paging.banner.item_name" value="Employee" />
<display:setProperty name="paging.banner.items_name" value="Employees" />
</display:table>