это я снова. По сути, я проверяю роли пользователя, когда он попадает на страницу. Это массив, скажем, 1,2,3. Содержимое последнего столбца в jsp для тестирования имеет роли #, которые прикреплены к каждому отдельному вложению. Последний столбец не будет на готовом продукте, но мне нужно сделать что-то вроде IF
для этого массива, чтобы увидеть, есть ли какие-либо значения в массиве:
<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>
Теперь массивы должны точно совпадать, просто значение в массиве пользовательских ролей находится в массиве ролей вложений ....
Мне нужно сделать здесь проверку, чтобы определить, стоит ли ставить флаг отключения на кнопку «удалить»:
<rbac:check operation="<%=Operation.DELETE%>">
<button type="button" onclick="javascript:delete_prompt(${item.id});">Delete</button>
</rbac:check>
</td>
<td>