日期:2014-05-18  浏览次数:20719 次

输入查询条件查询数据库出错 谁能帮忙看看那里出问题了
通过输入框选择输入查询条件转向查询页面后出错   谁能帮忙看看那里出问题了    
HTTP   Status   500   -  

--------------------------------------------

type   Exception   report

message  

description   The   server   encountered   an   internal   error   ()   that   prevented   it   from   fulfilling   this   request.

exception  

org.apache.jasper.JasperException:   Unable   to   compile   class   for   JSP:  


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:435)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:299)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


note   The   full   stack   trace   of   the   root   cause   is   available   in   the   Apache   Tomcat/5.5.23   logs.


--------------------------------------------

Apache   Tomcat/5.5.23

------解决方案--------------------
sql= "select * from bookinfo where "+sel_type+sel_comp+ " ' "+sel_type_value+ " ' ";
SQL语句有问题!
------解决方案--------------------
<%ResultSet rs=dbutil.query(sql);
if((rs!=null)&&(!rs.isLast())){
while(rs.next()){
%>
<tr bgcolor= "#dddddd ">
<td bgcolor= "#dddddd "> <div align= "center "> <%=rs.getString( "bookid ") %> </div> </td>
<td bgcolor= "#dddddd "> <div align= "center "> <%=new String(rs.getSting( "book_type ")) %> </div> </td>
<td bgcolor= "#dddddd "> <div align= "center "> <%=new String(rs.getString( "book_name ")) %> </div> </td>
<td bgcolor= "#dddddd "> <div align= "center "> <%=new String(rs.getString( "book_author ")) %> </div> </td>

</tr>
<% }//最后的这段代码,看这里是不是少了个花括号呢?(if的一个,while的一个,你现在只有一个)
%>



</body>
</html>
再就是你输入查询条件的那个页面,图书的类型、名称、作者怎么用那几个运算符比较??

------解决方案--------------------
<jsp:useBean id= "dbutil " scope= "request " class= "javabean.dbutil "/>
没错吗?建议从这句开始debug。
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.aiyiweb.com/java-web/317.html
我的异常网推荐解决方案:org.apache.jasper.Ja