有好心人帮看下么,由于刚接触jsp  改了好几遍了 所以有些注释没有去掉
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%@ page import="java.sql.*" %>
<%@ page import="userMes.UserMes" %>
<%@ page import="common.SQL_BEAN" %>
<html>
  <head>
  <%

String pagesql,sql;
ResultSet pagers,rs;
int i;
int ipage=10; //分页单位
int allpage; //总页数
int pages; //接受的页码变量
int cpage=1; //当前页
int allCol=0; //总记录数
int beginpos=0; //每页开始位置
int endpos=0; //每页的结束位置 //注册驱动
SQL_BEAN sql_bean = new SQL_BEAN();
Connection sqlCon = sql_bean.getConnection();
Statement sqlStmt =sqlCon.createStatement();
UserMes userMes = null;
List userList = (List) request.getAttribute("userlist");
System.out.println("长度"+userList.size());
        Iterator it = userList.iterator();
while (it.hasNext()){
userMes = (UserMes)it.next();
}

String newsql = userMes.getNewsql();
System.out.println("new sql = "+newsql); //取总记录数
allCol = userMes.getCount();
//获得总页面数
allpage = (allCol+ipage-1)/ipage;
//判断参数pages是否为空
if (request.getParameter("pages")==null){
pages=1;
beginpos=0;
endpos=ipage;
}else{
pages = new Integer(request.getParameter("pages")).intValue();
} //判断当前页
if(pages > allpage || pages <1){
cpage = 1; //--默认当前要显示的页码
beginpos=0; //--默认记录开始的位置为0
endpos=ipage; //--默认结束位置为第一页的结尾
}else{
cpage = pages; //--当前要显示的页码
beginpos=pages*ipage-ipage; //--得到记录开始的位置
endpos=pages*ipage; //--得到记录结束的位置
}

//sql = newsql;
//rs= sqlStmt.executeQuery(sql); //--得到要分页的结果集 //for(i=0;i<beginpos;i++){
//    System.out.println("1");
// rs.next(); //--把结果集的记录数移到要显示的页的记录的开始位置
// System.out.println("2");
//}
%>
  <body>
  <table width="100%" border="0">
  <tr>
    <th width="5%" scope="col"><img src="img/mbi_015.gif" alt="mbi_015.gif"/></th>
    <th width="17%" scope="col"><font size="3">用户信息查询</font></th>
    <th width="78%" scope="col" align="left"><img src="img/index_t34.gif" alt="index_t34.gif"/></th>
  </tr>
</table><div>
<table width="100%" border="0">
  <tr>
   <th width="40%" align="left">
     <a href="<%=request.getContextPath()%>/downus.do"><font size="2" color="#0000FF">点此生成Excel文件</font></a></th>
  </tr>
</table> 
</div><form action="<%=request.getContextPath()%>" method="post" name="showUserMes">
<table border=1 width=100% style="border-collapse:collapse;border:thin solid #BABABA; font-size:12px;" align="center">
  <tr bgcolor="#EAE8E5">
    <th scope="col"><strong>编号</strong></th>
    <th scope="col"><strong>手机号码</strong></th>
    <th scope="col"><strong>申请时间</strong></th>
    <th scope="col"><strong>申请业务</strong></th>
    <th scope="col"><strong>可用积分</strong></th>
    <th scope="col"><strong>剩余积分</strong></th>
    <th scope="col"><strong>操作时间</strong></th>
    <th scope="col"><strong>操作者</strong></th>
    <th scope="col"><strong>是否受理</strong></th>
    <th scope="col"><strong>操作</strong></th>
  </tr>
  <%
   // int ii=0;
// for(int j=beginpos;j<endpos;j++){ //---从开始位置读取记录一直到结束位置
// if(rs.next()){
// System.out.println("rs的长度="+rs.getRow());
// ii++;
// System.out.println("ii = "+ii);
//String telNo=new String(rs.getString("telNo").getBytes("8859_1"),"gb2312");
//String apply_Time=rs.getDate("apply_Time").toString();
//String apply_Business=new String(rs.getString("apply_Business"));
//String possession_JF=new String(rs.getString("possession_JF").getBytes("8859_1"),"gb2312");
//String spare_JF=new String(rs.getString("spare_JF").getBytes("8859_1"),"gb2312");
//String op_Date=new String(rs.getDate("op_Date").toString());
//String op_User=new String(rs.getString("op_User").getBytes("8859_1"),"gb2312");
//String ynaccept=new String(rs.getString("ynaccept"));   //pb = (PageBean) session.getAttribute("pagebean");
   //System.out.println("jsp pb = "+pb.toString());
   //int time = session.getMaxInactiveInterval();
   //System.out.println("time="+time);
userList = (List) request.getAttribute("userlist");
System.out.println(userList.size());
int ii=0;
    it = userList.iterator();
for (int j=beginpos;j<endpos;j++){
    ii++;
userMes = (UserMes)it.next();
%>  <tr align="center">
  <td><%= ii %></td>
  <td><%= userMes.getTelNo() %></td>
  <td><%= userMes.getApply_Time() %></td>
  <td><%= userMes.getApply_Business() %></td>
  <td><%= userMes.getPossession_JF() %></td>
  <td><%= userMes.getSpare_JF() %></td>
  <td><%= userMes.getOp_Date() %></td>
  <td><%= userMes.getOp_User() %></td>
  <%
   if(userMes.getYnaccept().equals("已受理")){
  %>
  <td><font style="color:#009933; font-size:12px"><%= userMes.getYnaccept() %></font></td>
  <%
   }
  %>
  <%
   if(userMes.getYnaccept().equals("未受理")){
  %>
  <td><font style="color:#FF0000; font-size:12px"><%= userMes.getYnaccept() %></font></td>
  <%
   }
  %>
  <td><a href="#">修改</a></td>
  </tr>
  <%
//}
userMes = null;
//else break;
}
%></table>
</form>
<p>
<TABLE align=center border=0 cellPadding=0 cellSpacing=0 width="100%">
<TR>
<TD>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
<TR>
<TD class="font">
<FONT class="font">
总计<font style="color=red"><%= allCol %></font>条记录 
| 每页<f[size=14px]ont style="color=red"><%=ipage%></font>条 
| 共 <font style="color=red
"><%= allpage %></font>页 |

</FONT>
</TD>
<td align="right">
  <form name=form1 method=post action=show_usermes.jsp>
<font class="font">
当前页为:<font style="color=red"><%=cpage%></font>/<font style="color=green"><%=allpage%></font> |
<% if (cpage>1){ %>
<a href="show_usermes.jsp?pages=1"><FONT color=blue>[首页]</a> |
<a href="show_usermes.jsp?pages=<%= cpage-1 %>"><FONT color=blue>[上一页]|</a>
<% }
if (cpage<allpage){ %>
<a href="show_usermes.jsp?pages=<%= cpage+1 %>"><FONT color=blue>[下一页]</a> |
<a href="show_usermes.jsp?pages=<%=allpage%>"><FONT color=blue>[尾页]</a>
<% } %>
 </font>
 <font class="font" color="black">
跳转至:<select name="pages" size="1" HEIGHT="20">
<%
for(int m=0;m<allpage;m++){
%>
<option value="<%=m+1%>">第<%=m+1%>页</option>
<%}%>
</select>
  <input name="B1" type="submit" tabindex="1" WIDTH="70" HEIGHT="20" value="go" >
  </font>
    </form>
</td>
</TR>


</TABLE></body>
</html>[/size]

解决方案 »

  1.   

    点下一页是提示空置针异常。
    java.lang.NullPointerException
    org.apache.jsp.show_005fusermes_jsp._jspService(show_005fusermes_jsp.java:91)
    这个页面时得到查询出的 List   userList   =   (List)   request.getAttribute("userlist"); 
    根据用户查询条件的不同得到的结果也不同。
    所以在此页面 没有sql语句。还有就是有没有人能告诉我 当 点下一页时 程序是怎么执行的阿 我有点不是很清楚