jsp调用存储过程后分页数据显示不出来
哪为高手帮忙看一下,谢谢
<%@ include file= "purview.jsp "%>
<%@ page language = "java " contentType = "text/html;charset=gb2312 "%>
<%@ page import = "java.sql.* "%>
<%@ page import = "javax.naming.* "%>
<%@ page import = "javax.sql.DataSource "%>
<%@ page import= "java.text.DecimalFormat "%>
<html>
<head>
<LINK href= "../css/main.css " type= "text/css " rel=stylesheet>
<LINK href= "../css/rubbing.css " type= "text/css " rel=stylesheet>
<link rel= "stylesheet " href= "../css/style.css " type= "text/css ">
</head>
<body background= "../images/bg.jpg " >
<%
String strGClass = request.getParameter( "GClass ");
if (strGClass == null || strGClass == " ")
strGClass = "-1 ";
String iGName = request.getParameter( "GName ");
if (iGName == null || iGName == " ")
iGName = " ";
iGName = new String(iGName.getBytes( "ISO8859-1 "));
String iGCode = request.getParameter( "GCode ");
if (iGCode == null || iGCode == " ")
iGCode = " ";
iGCode = new String(iGCode.getBytes( "ISO8859-1 "));
int iGClass = Integer.parseInt(strGClass);
try{
Context initCtx = new InitialContext();
DataSource ds=null;
ds = (DataSource) initCtx.lookup( "java:comp/env/jdbc/webTbd ");
Connection conn = ds.getConnection();
CallableStatement cstmt = null;
ResultSet rs = null;
String sql = null;
cstmt = conn.prepareCall( "{?=call t_LGoodsPrice(?, ?, ?)} ");
cstmt.registerOutParameter(1, java.sql.Types.INTEGER);
cstmt.setInt(2, iGClass);
cstmt.setString(3, iGName);
cstmt.setString(4, iGCode);
rs = cstmt.executeQuery();
/*××××××××××××××××××××××××分页××××××××××××××××××××××*/
int intPageSize; //一页显示的记录数
int intRowCount; //记录总数
int intPageCount; //总页数
int intPage; //待显示页码
String strPage;
int i;
//设置一页显示的记录数
intPageSize=1;
//MySelf=Request.ServerVariables( "PATH_INFO ");
//取得待显示页码
strPage=request.getParameter( "page ");
if(strPage==null)//表明在QueryString中没有Page这一个参数,此时显示第一页数据
intPage=1;
else{//将字符串转换成整型
intPage=java.lang.Integer.parseInt(strPage);
if(intPage <1) intPage=1;
}
out.println(rs);
//获取记录总数
rs.last();
intRowCount=rs.getRow();
//记算总页数
intPageCount =(intRowCount+intPageSize-1)/intPageSize;
//调整待显示的页码
if(intPage> intPageCount) intPage=intPageCount;
if(intPageCount> 0)
//将记录指针定位到待显示页的第一条记录上
rs.absolute((intPage-1)*intPageSize+1);
//显示数据
i=0;
%>
<table border= "1 " width= "100% " align= "center " cellspacing= "0 " cellpadding= "0 " class= "f_sm ">
<%
out.println( " <tr> <td align=center> <STRONG> 货品编码 </STRONG> </td> ");
out.println( " <td align=center> <STRONG> 货品名称 </STRONG> </td> ");
out.println( " <td align=center> <STRONG> 单位 </STRONG> </td> ");
out.println( " <td align=center> <STRONG> 库存数量 </STRONG> </td> ");
out.println( " <td align=center> <STRONG> 售货价 </STRONG> </td> ");
out.println( " <td align=center> <STRONG> 提前订货期(天) </STRONG> </td> </tr> ");
DecimalFormat df = new DecimalFormat( "#0.00 ");
while(i <intPageSize &&! rs.isAfterLast()){
out.println( " <tr> <td align=center> " + rs.getString( "code ") + " </td> ");
out.println( " <td align=center> " + rs.getString( "name ") + " </td> ");
out.println( " <td align=center> " + rs.getString( "unit ") + " </td> ");
out.println( " <td align=center> " + df.format(rs.getDouble( "tonhand ")) + " </td> ");
out.println( " <td align=center> " + df.format(rs.getDouble( "sprice ")) + " </td> ");
out.println( " <td align=center> " + rs.getInt( "leadtime ") + " </td> </tr> ");
}
%>
<%
rs.next();
i++;
%>
</table>
第 <%=intPage%> 页 共 <%=intRowCount%> 条记录/共 <%=intPageCount%> 页 <br>
<%if(intPage <2){ %> 首页 | 上一页
<% }else{%> <a href= "page.jsp?page=1 "> 首页 </a> | <a href= "page.jsp?page= <%=intPage-1%> "> 上一页 </a>
<%}%>
<%if((intPageCount-intPage) <1){ %> 下一页 | 尾页
<%}else{%>
<a href= "page.jsp?page= <%=intPage+1%> "> 下一页 </a> | <a href= "page.jsp?page= <%=intPageCount%> "> 尾页 </a>
<%}%>
<%
rs.close();
cstmt.close();
conn.close();
}catch (Exception e){
e.printStackTrace();
}
%>
</body>
</html>
[解决办法]
估计是分页没处理好,把报错信息贴出来
------解决方案--------------------
最烦的就是问问题把一大堆的代码贴出来,分页的例子或是思路在网上起码存活了N多年了,这个问题真心盼望楼主不要再问了。