有一个完整的JSP程序,我把整个包放在tomcat的root文件夹下,但是运行的时候出现如下的错误:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /shop/top.jsp at line 58
55: String sql="select top 1 * from system";
56: ResultSet rs;
57: rs=mdb.executeQuery(sql);
58: if(rs.next()){
59: %>
60: <%=rs.getString("web")%> - <%=rs.getString("sitename")%>
61: <%
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
不知道怎么修改,谁知道的能不能告诉声,究竟是文件放错了还是其他什么原因
还有我是不是要把.class文件和jsp文件放在同一个文件夹中呢?
<jsp:useBean id="mdb" class="ckstudio.db.faq" scope="page"/>这样写格式对不对呢?为什么我每次运行都显示错误
------解决方案--------------------
看看结果集rs是不是空?
------解决方案--------------------
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
conn = mdb.connection();
if (conn!=null) {
stmt = conn.createStatement();
String sql="select top 1 * from system";
rs = stmt.executeQuery(sql);
最后不要忘记了....
<%
} finally {
try {
if (rs != null) {
rs.close();
rs = null;
}
if (stmt != null) {
stmt.close();
stmt = null;
}
if (conn != null) {
conn.close();
conn = null;
}
} catch (SQLException e) {
e.printStackTrace();
}
}
%>
代码迷推荐解决方案:An exception occurred processing JSP page,http://www.daimami.com/search?q=33144
代码迷推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.daimami.com/search?q=317