Invalid chunk ignored
下面是一段分页程序,请大家仔细看一下,只要看我标记的地方就行。
<%
int i;
int ipage=5; //分页单位
int allpage; //总页数
int pages; //接受的页码变量
int cpage=1; //当前页
int spage; //开始页
int allCol=0;
Vector v=null;
//数据库连接声明
Connection conn=null;
java.lang.String sql,pagesql;
java.sql.ResultSet rs,pagers;
Statement statement=null;
String kmsdb= "jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=DBName ";
Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver ");
conn = DriverManager.getConnection(kmsdb, "user ", "pwd ");
pagesql = "SELECT COUNT(*) FROM Authors ";
//取总文章数
statement = conn.createStatement();
pagers = statement.executeQuery(pagesql);
while(pagers.next())
{
/*****************请看这里*******************/
allCol = pagers.getInt(1);
System.out.println(allCol);
//如果去掉System.out.println(allCol);比如我输入第55页的时候(实际上根本没那么多页) ,则会在控制台上打印出:
//2007-6-12 12:54:34 org.apache.tomcat.util.http.Parameters processParameters
//警告: Parameters: Invalid chunk ignored.
/*****************以上是出问题的地方*******************/
}
//获得总页面数
allpage = (int)Math.ceil((allCol + ipage-1) / ipage);
//判断参数pages是否空
if (request.getParameter( "pages ")==null) {
pages=1;
} else {
pages = new Integer(request.getParameter( "pages ")).intValue();
System.out.println(pages);
}
//判断当前页
if(pages > allpage || pages == 0)
{cpage = 1;}
else
{
cpage = pages;
}
//判断起始页
sql = "select Top "+ipage+ " au_id,au_lname,au_fname,address,phone from authors where au_id not in (select top "+(cpage-1)*ipage+ " au_id from authors order by au_id desc)order by au_id desc ";
rs = statement.executeQuery(sql);
while (rs.next())
{
au_id=rs.getString( "au_id ");
au_lname=rs.getString( "au_lname ");
au_fname=rs.getString( "au_fname ");
phone=rs.getString( "phone ");
address=rs.getString( "address ");
%>
<td width= "300 "> <%= au_id %> </a> </td>
<td width= "300 "> <%= au_lname %> </a> </td>
<td width= "300 "> <%= au_fname %> </a> </td>
<td width= "300 ">