主题:高手们请这边看,帮我解决下这个难题啊,很急啊,谢谢啊
这是我的browse.jsp文件
<%@ page import ="java.sql.*"%>
<%@ page import ="count.SessionListener"%>
<%@ page language ="java"%>
<%
if(session.getAttribute("username")==null)
{
response.sendRedirect();
}
%>
<jsp:useBean id ="mybook" scope ="page" class="book.Bk"/>
<%
int PageSize =8;
int ShowPage =1;
int RowCount =0;
int PageCount=0;
ResultSet rs =mybook.executeQuery("SELECT * FROM books");
rs.last();
RowCount=rs.getRow();
PageCount =((RowCount % PageSize)==0?(RowCount/PageSize):(RowCount/PageSize)+1);
%>
<html>
<head>
<title>网上平价书店</title>
</head>
<body>
<center>
<font size =5 color =blue>Welcome to the on_line bookstore</font>
</center>
<center><p>在线人数:<%=SessionListener.getCount()%></p>
</center>
<br>
<hr>
<br>
<center>
<%
String ToPage=request.getParameter("ToPage");
if(ToPage!=null)
{
ShowPage =Integer.parseInt(ToPage);
if(ShowPage>PageCount)
{
ShowPage=PageCount;
}
elseif(ShowPage<=0)
{
ShowPage =1;
}
}
rs.absolute((ShowPage-1)*PageSize +1);
%>
<h3>当前在第<font size =4 color =red>
<%=ShowPage %></font>页,共
<font size =4 color =red>
<%=PageCount %></font>页,</h3>
<br>
<table border="1" width ="100%">
<tr>
<td width ="33%"> 书名</td>
<td width ="33%"> 作者</td>
<td width ="10%"> 价格</td>
<td width ="24%"> 购书</td>
</tr>
<%
int i=0;
while(rs.next()){
i=i+1;
%>
<tr>
<td width ="35%"><%=rs.getString("name")%></td>
<td width ="35%"><%=rs.getString("author")%></td>
<td width ="10%"><%=(rs.getInt("price"))%></td>
<td width ="22%"><a href ="cart.jsp?book_id=<%=rs.getInt("name")%>">选购此书</a></td>
</tr>
<%
if(i==PageSize)
{
break;
}
%>
<%
}
rs.close();
%>
</table>
<table>
<tr valign=baseline align=center>
<%
if(ShowPage!=1)
{
%>
<td width=150>
<a href =browse.jsp? ToPage=<%=ShowPage-1 %>>到上一页</a>
</td>
<%
}
if(ShowPage!=PageCount)
{
%>
<td width =150>
<a href=browse.jsp? ToPage=<%=ShowPage+1 %>>到下一页</a>
</td>
<td width =150>
<a href =browse.jsp? ToPage=<%=PageCount %>>到最后一页</a>
</td>
<%
}
%>
<td width =150>
<form action =browse.jsp.jsp method =POST>
到
<INPUT type ="text" name =ToPage style ="height:25px;width:40px">
value=<%=ShowPage%>>页
</form></td></tr>
</table>
</center>
</body>
</html>
///////////////////////////////////////
错误提示;
The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 36 in the jsp file: /browse.jsp
Generated servlet error:
D:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\webbook\org\apache\jsp\browse_jsp.java:103: 需要 ';'
{
^
1 错误
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:670)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:637)
org.apache.jsp.login_005fconfirm_jsp._jspService(login_005fconfirm_jsp.java:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
我真得不知道哪里少分号(;)了,
[em10][em10]
<%@ page import ="java.sql.*"%>
<%@ page import ="count.SessionListener"%>
<%@ page language ="java"%>
<%
if(session.getAttribute("username")==null)
{
response.sendRedirect();
}
%>
<jsp:useBean id ="mybook" scope ="page" class="book.Bk"/>
<%
int PageSize =8;
int ShowPage =1;
int RowCount =0;
int PageCount=0;
ResultSet rs =mybook.executeQuery("SELECT * FROM books");
rs.last();
RowCount=rs.getRow();
PageCount =((RowCount % PageSize)==0?(RowCount/PageSize):(RowCount/PageSize)+1);
%>
<html>
<head>
<title>网上平价书店</title>
</head>
<body>
<center>
<font size =5 color =blue>Welcome to the on_line bookstore</font>
</center>
<center><p>在线人数:<%=SessionListener.getCount()%></p>
</center>
<br>
<hr>
<br>
<center>
<%
String ToPage=request.getParameter("ToPage");
if(ToPage!=null)
{
ShowPage =Integer.parseInt(ToPage);
if(ShowPage>PageCount)
{
ShowPage=PageCount;
}
elseif(ShowPage<=0)
{
ShowPage =1;
}
}
rs.absolute((ShowPage-1)*PageSize +1);
%>
<h3>当前在第<font size =4 color =red>
<%=ShowPage %></font>页,共
<font size =4 color =red>
<%=PageCount %></font>页,</h3>
<br>
<table border="1" width ="100%">
<tr>
<td width ="33%"> 书名</td>
<td width ="33%"> 作者</td>
<td width ="10%"> 价格</td>
<td width ="24%"> 购书</td>
</tr>
<%
int i=0;
while(rs.next()){
i=i+1;
%>
<tr>
<td width ="35%"><%=rs.getString("name")%></td>
<td width ="35%"><%=rs.getString("author")%></td>
<td width ="10%"><%=(rs.getInt("price"))%></td>
<td width ="22%"><a href ="cart.jsp?book_id=<%=rs.getInt("name")%>">选购此书</a></td>
</tr>
<%
if(i==PageSize)
{
break;
}
%>
<%
}
rs.close();
%>
</table>
<table>
<tr valign=baseline align=center>
<%
if(ShowPage!=1)
{
%>
<td width=150>
<a href =browse.jsp? ToPage=<%=ShowPage-1 %>>到上一页</a>
</td>
<%
}
if(ShowPage!=PageCount)
{
%>
<td width =150>
<a href=browse.jsp? ToPage=<%=ShowPage+1 %>>到下一页</a>
</td>
<td width =150>
<a href =browse.jsp? ToPage=<%=PageCount %>>到最后一页</a>
</td>
<%
}
%>
<td width =150>
<form action =browse.jsp.jsp method =POST>
到
<INPUT type ="text" name =ToPage style ="height:25px;width:40px">
value=<%=ShowPage%>>页
</form></td></tr>
</table>
</center>
</body>
</html>
///////////////////////////////////////
错误提示;
The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 36 in the jsp file: /browse.jsp
Generated servlet error:
D:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\webbook\org\apache\jsp\browse_jsp.java:103: 需要 ';'
{
^
1 错误
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:670)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:637)
org.apache.jsp.login_005fconfirm_jsp._jspService(login_005fconfirm_jsp.java:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
我真得不知道哪里少分号(;)了,
[em10][em10]