jsp、jstl、<c:forEach>
jsp引入
1 <%@ taglib prefix="shiro" uri="/WEB-INF/tlds/shiros.tld" %> 2 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 3 <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> 4 <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 5 <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 6 <%@ taglib prefix="fns" uri="/WEB-INF/tlds/fns.tld" %> 7 <%@ taglib prefix="sys" tagdir="/WEB-INF/tags/sys" %> 8 <%@ taglib prefix="table" tagdir="/WEB-INF/tags/table" %> 9 <%@ taglib prefix="common" tagdir="/WEB-INF/tags/common" %> 10 <%@ taglib prefix="t" uri="/menu-tags" %> 11 <c:set var="ctx" value="${pageContext.request.contextPath}${fns:getAdminPath()}"/> 12 <c:set var="ctxStatic" value="${pageContext.request.contextPath}/static"/>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
jsp部分
1 <c:forEach items="${page.list}" var="identityIdentification"> 2 <tr> 3 <td><a> 4 ${identityIdentification.id} 5 </a></td> 6 <td> 7 ${fns:getDictLabel(identityIdentification.type, 'type', '')} 8 </td> 9 10 <td> 11 <fmt:formatDate value="${identityIdentification.generateData}" pattern="yyyy-MM-dd HH:mm:ss"/> 12 </td> 13 <td> 14 ${identityIdentification.generateBy} 15 </td> 16 <td> 17 <shiro:hasPermission name="identification:identityIdentification:del"> 18 <a href="${ctx}/identification/identityIdentification/delete?id=${identityIdentification.id}"
onclick="return confirmx('确认要删除该身份标识符吗?', this.href)" class="del_btn btn btn-danger btn-xs">
<i class="fa fa-trash"></i> 删除</a> 19 </shiro:hasPermission> 20 </td> 21 </tr> 22 </c:forEach>
controller
1 /** 2 * 生成身份标识符成功列表页面 3 */ 4 @RequiresPermissions("identification:identityIdentification:list") 5 @RequestMapping(value = {"list", ""}) 6 public String list(IdentityIdentification identityIdentification, HttpServletRequest request, HttpServletResponse response, Model model) { 7 Page<IdentityIdentification> page = identityIdentificationService.findPage(new Page<IdentityIdentification>(request, response), identityIdentification); 8 model.addAttribute("page", page); 9 return "modules/identification/identityIdentificationList"; 10 }