标签:pos isa div alt this com ima 方法 .com
<dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId> <version>5.0.0</version> </dependency>
<plugin interceptor="com.github.pagehelper.PageInterceptor"> </plugin>
public ModelAndView home(@RequestParam(value="pn",defaultValue="1")Integer pn)
//在查询之前调用 //显示的页码,每页显示的个数 PageHelper.startPage(pn,5); //startPage 后紧跟一个查询 List list = this.adminFacade.getAllTeacher(pd); //使用 PageInfo 包装 PageInfo page = new PageInfo(list); mv.addObject("teachers", page);
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<table>
<c:forEach items="teachers" var="teacher">
<tr>
<td>${teacher.tname}</td>
<td>${teacher.fullname }</td>
</tr>
</table>
//页码逻辑
<ul> <li><a href="<%=basePath%>address/message?pn=1">首页</a></li> <c:if test="${pageInfo.hasPreviousPage}"> <li class="prev disabled"><a href="<%=basePath%>address/message?pn=${pageInfo.pageNum-1}">?</a></li> </c:if> <c:forEach items="${pageInfo.navigatepageNums }" var="page_Num"> <c:if test="${page_Num==pageInfo.pageNum }"> <li class="active"><a href="#">${page_Num}</a></li> </c:if> <c:if test="${page_Num!=pageInfo.pageNum }"> <li><a href="<%=basePath%>address/message?pn=${page_Num}">${page_Num}</a></li> </c:if> </c:forEach> <c:if test="${pageInfo.hasNextPage}"> <li class="next"><a href="<%=basePath%>address/message?pn=${pageInfo.pageNum+1}">?</a></li> </c:if> <li><a href="<%=basePath%>address/message?pn=${pageInfo.pages}">末页</a></li> </ul>
或 ajax 调用
function userLogin(URL,HREF) { var data = $(".login").serialize(); $.ajax({ url : URL, type : "post", data : data, dataType : ‘json‘, success : function(data) { if (data.check == "true") {
//前往的地址 window.location.href =abroot + HREF; } else { alert("用户名或口令输入错误"); } }, error : function(data) { alert("用户名或口令输入错误"); } }); }
标签:pos isa div alt this com ima 方法 .com
原文地址:https://www.cnblogs.com/oneMr/p/9959901.html