jsp分页报错问题..
大家好..
请大家帮忙看看..
tomcat报错如下:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 36 in the jsp file: /booklist2.jsp
Generated servlet error:
Syntax error on tokens, delete these tokens
org.apache.jasper.servlet.JspServletWrapper.handle
JspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
____________________________________________________________________
它好象说booklist2.jsp的36行出错..
但是36行是 " <% "的代码片段的开头..
这个分页代码是我从网上搜索回来的..
之前booklist2.jsp显示数据是没有问题的..
下面贴出我booklist2.jsp的代码:
<%@ page contentType= "text/html;charset=gb2312 " %>
<%@ include file= "incoming/common.jsp "%>
<html>
<head>
<title> 网络书店 </title>
<%
DBSQLManager dbsm = new DBSQLManager();
String sql= "SELECT * FROM bookinfo order by DATET DESC ";
dbsm.setSqlStr(sql);
dbsm.executeQuery();
ResultSet rs=dbsm.getRs();
int i;
%>
<%
String pg=request.getParameter( "pg ");
if(pg==null)
pg= "1 ";
int tt;//记录总数
rs.last();
//得到纪录条数
tt=rs.getRow();
//指回接过级首位
rs.first();
int pagex;
//这里的 tt%10 为每页显示纪录的条数,可以自己定义
if(tt%10==0)
//这里计算共多少页,有于数,那么页数+1
{pagex=(tt/10);}
else
{pagex=(tt/10)+1;}//计算总页数
int pagey;//从用户那里得到的目标页
pagey=Integer.parseInt(pg);
如果页数小于1,那么把页数设置成1
if(pagey <1)
{
pagey=1;
}
//如果页数大于总页数,那么设置成最大页数
if(pagey> pagex)
{
pagey=pagex;
}
//翻页开始,调整记录指针的位置
int n=(pagey-1)*10+1;
int a;
for(a=0;a <n-1;a++)
{
if(!rs.isLast())
rs.next();
}
//翻页结束
%>
<table width= "700 " border= "1 " cellpadding= "0 " cellspacing= "0 " bordercolor= "#FFFFFF ">
<tr>
<td width= "39% " height= "20 " bgcolor= "#3399FF "> <div align= "center " class= "STYLE2 ">
<div align= "left "> 书名 </div>
</div> </td>
<td width= "14% " bgcolor= "#3399FF "> <div align= "center " class= "STYLE2 ">
<div align= "left "> 作者 </div>
</div> </td>
</tr>
<!-- 循环输出开始 &n