|
org.apache.jasper.JasperException: An exception occurred processing JSP page /test.jsp at line 48
45: if (currentpage == null) {
46: currentpage = "1";
47: }
48: int pageindex = Integer.parseInt(currentpage);
49: if (pageindex < 1) {
50: pageindex = 1;
51: } else if (pageindex > totalpage) {
java code
request.setCharacterEncoding("GBK");
page p = new page();
int count = p.getCount();
int pagesize = 2;
int totalpage = p.getTotalpage(count, pagesize);
String currentpage = request.getParameter("pageindex");
//System.out.println(currentpage);
if (currentpage == null) {
currentpage = "1";
}
int pageindex = Integer.parseInt(currentpage);
if (pageindex < 1) {
pageindex = 1;
} else if (pageindex > totalpage) {
pageindex = totalpage;
}
List<News> list = p.getnewslist(pageindex, pagesize);
//request.setAttribute("newslist", list);
for (News news : list) {
%>
<%=news.getTitle()%><br />
<%
}
%>
当前页数[<%=pageindex%>/<%=totalpage%>]
<%
if (pageindex > 1) {
%>
<a href="test.jsp?pageindex=1">首页</a>
<a href="test.jsp?pageindex=" <%=pageindex - 1%>>shang(上)一页</a>
<%
}
if (pageindex < totalpage) {
%>
<a href="test.jsp?pageindex=" <%=pageindex + 1%>>下一页</a>
<a href="test.jsp?pageindex=" <%=totalpage%>>尾页</a>
<%
}
%>
http://www.javaxxz.com |
|