为了账号安全,请及时绑定邮箱和手机立即绑定

为什么点击下一页就出错

为什么点击下一页就出错

枫夜流萤 2017-12-29 20:04:23
<%@ page language="java" pageEncoding="UTF-8"%> <%@ page import="java.util.*"%>//下面这些是导包和javabean <%@ page import="Bean.PersoninfoForm"%> <jsp:useBean id="FyeBean"  class="Dao.FenyeAction" scope="page"></jsp:useBean> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html:html locale="true"> <head>  <html:base />  <title>查询</title>  <meta http-equiv="pragma" content="no-cache">  <meta http-equiv="cache-control" content="no-cache">  <meta http-equiv="expires" content="0">  <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">  <meta http-equiv="description" content="This is my page">  <!--  <link rel="stylesheet" type="text/css" href="styles.css">  --> </head> <body>    <%   //变量声明    int intPageSize; //一页显示的记录数    int intRowCount; //记录总数    int intPageCount; //总页数    int intPage; //待显示页码    java.lang.String strPage;   int i;   //设置一页显示的记录数    intPageSize = 4;   //取得待显示页码    strPage = request.getParameter("page");   if (strPage == null) {//表明在QueryString中没有page这一个参数,此时显示第一页数据     intPage = 1;   } else {//将字符串转换成整型     intPage = java.lang.Integer.parseInt(strPage);    if (intPage < 1)     intPage = 1;   }   intRowCount = FyeBean.count();//获得总记录数。用javabean调用了FenyeAction中的方法,得到总记录数,    //记算总页数    intPageCount = (intRowCount + intPageSize - 1) / intPageSize;   //调整待显示的页码,如果大于总页数就等于总页数    if (intPage > intPageCount)    intPage = intPageCount;  %>  <form method="POST" action="chaxun.jsp">   <p>    第    <%=intPage%>    页 共    <%=intPageCount%>    页        <%   if (intPage < intPageCount) {   %>    <a href="chaxun.jsp?page=<%=intPage + 1%>">下一页 </a>    <%    }    %>    <%    if (intPage > 1) {    %>    <a href="chaxun.jsp?page=<%=intPage - 1%>"> 上一页</a>    <%    }    %>    转到第:    <input type="text" name="page" size="8">    页    <span> <input class=buttonface type="submit" value="GO"      name="cndok"> </span>   </p>   <table width="169" border="1" cellpadding="0" cellspacing="0">    <tr>     <th width="28">      车牌     </th>     <th width="82">      车型     </th>     <th width="51" >      状态     </th>     <th width="51" >      用户     </th>     <th width="51" >      日期     </th>     <th width="51" >      产地     </th>    </tr>    <%    //查询数据库,获得记录数据    Collection c;    PersoninfoForm psinfo;    c = FyeBean.fenye();    Object o[] = c.toArray();        System.out.println(intPage);//测试用    System.out.println(intPageSize);    System.out.println(intPageCount);    int start = (intPage - 1) * (intPageSize);    int end = (intPage - 1) * (intPageSize) + intPageSize;    int j;     for (j = start; j < end; j++) {      psinfo = (PersoninfoForm) o[j];      String busNum = psinfo.getBusNum();      String busType = psinfo.getBusType();      String busStatus = psinfo.getBusStatus();      String busUser = psinfo.getBusUser();      String busDate = psinfo.getBusDate();      String busPlace = psinfo.getBusPlace();    %>    <tr>     <td>      <%=busNum%>     </td>     <td>      <%=busType%>     </td>     <td>      <%=busStatus%>     </td>     <td>      <%=busUser%>     </td>     <td>      <%=busDate%>     </td>     <td>      <%=busPlace%>     </td>    </tr>    <%    }    %>   </table>  </form> </body> </html:html>
查看完整描述

1 回答

?
黄沛元

TA贡献23条经验 获得超5个赞

你复制这代码上来有什么用,一不能运行,二人家看了那么多类更本不知道干嘛的。报错你就应该把错误响应的信息贴出来。

查看完整回答
反对 回复 2018-01-01
  • 1 回答
  • 0 关注
  • 1155 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信