再次匹配。基本上我在用戶瀏覽頁面時檢查角色。它的一個數組,可以說1,2,3。用於測試的jsp上最後一列的內容具有附加到每個單獨附件的角色#。最後一欄不會是在成品上,但我需要做某種IF
該陣列上,看是否有數組中的值:JSTL檢查一個數組中的值是否與第二個數組
<c:forEach items = "${hotPartRoles}" var = "hpRole">
${hpRole.id}
</c:forEach>
是連接角色的數組中:
<c:forEach items = "${item.roles}" var = "role">
${role.id}
</c:forEach>
JSP:
<table class="data_table">
<tr>
<th>Attachments</th>
//These are the user's Roles
<c:forEach items = "${hotPartRoles}" var = "hpRole">
${hpRole.id}
</c:forEach>
</tr>
<tr>
<td class="subtable">
<table class="data_table">
<c:choose>
<c:when test='${empty attachList}'>
<tr>
<td>No Attachments</td>
</tr>
</c:when>
<c:otherwise>
<tr>
<th>Remove Attachment</th>
<th>File Name</th>
<th>File Type</th>
<th>File Size (bytes)</th>
<th>File Attached By</th>
<th>Date/Time File Attached</th>
<th>Roles</th>
</tr>
<c:forEach var="item" items="${attachList}" varStatus="loopCount">
<tr>
<td class="button">
<rbac:check operation="<%=Operation.DELETE%>">
<button type="button" onclick="javascript:delete_prompt(${item.id});">Delete</button>
</rbac:check>
</td>
<td><a href="show.view_hotpart_attachment?id=${item.id}">${item.fileName}</a></td>
<td>${item.fileType}</td>
<td><fmt:formatNumber value="${item.fileSize}" /></td>
<td>${item.auditable.createdBy.lastName}, ${item.auditable.createdBy.firstName}</td>
<td><fmt:formatDate value="${item.auditable.createdDate}" pattern="${date_time_pattern}" /></td>
<td>
<c:forEach items = "${item.roles}" var = "role">
${role.id}
</c:forEach>
</td>
</tr>
</c:forEach>
</c:otherwise>
</c:choose>
</table>
現在ONT需要精確匹配的陣列,只是用戶角色的所述陣列中的值是固定角色的陣列中....
我需要在這裏做檢查,以determin是否把一個禁止標誌上的「刪除」按鈕:
<rbac:check operation="<%=Operation.DELETE%>">
<button type="button" onclick="javascript:delete_prompt(${item.id});">Delete</button>
</rbac:check>
</td>
<td>
即時通訊思想也許2嵌套的循環 – 2012-03-16 14:55:37
' ' –
2012-03-16 14:55:53
不確定... ..... – 2012-03-16 14:56:23