- 爱易网页
-
Java教程
- jsp调用存储过程后分页数据展示不出来
日期:2014-05-18 浏览次数:20630 次
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);
//获取记录总数