<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
动漫搜索
<% //currentPage当前显示页数
if (request.getParameter("currentPage") == null||request.getParameter("currentPage").equals(""))
{
pageContext.setAttribute("currentPage",
new Integer(0));
} else
{
pageContext.setAttribute("currentPage", request
.getParameter("currentPage"));
}
%>
select* from anime
<%
int perPageNum = Integer.parseInt((String) pageContext
.getAttribute("PerPageNum"));
int resultNum = Integer.parseInt((String) pageContext
.getAttribute("resultNum"));
int pageNum; //如果所有记录数除每页显示记录数没有余数-1
if((int)resultNum%perPageNum==0)
pageNum = (int)(resultNum / perPageNum-1);
else
pageNum = (int)(resultNum / perPageNum);
pageContext.setAttribute("pageNum", pageNum);
%>
总共有${pageNum+1}页-第${currentPage+1}页-
上一页 -
下一页
1