我已经使用netbeans用jsp和java编写了代码。每当我运行代码时,就会出现以下错误(在第6行,conroller.jsp调用database.java类):org.apache.jasper.jasperexception:在第[6]行处理[controller.jsp]时发生异常
3: <%@page import="myPackage.*"%>
4: <%@page import="java.util.*"%>
5: <%@page contentType="text/html" pageEncoding="UTF-8"%>
6: <jsp:useBean id="pDAO" class="myPackage.DatabaseClass" scope="page"/>
7: <%
8: if(request.getParameter("page").toString().equals("login")){
9: if(pDAO.loginValidate(request.getParameter("username").toString(), request.getParameter("password").toString())){
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:626)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:515)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
我的database.java文件如下:
public DatabaseClass() throws ClassNotFoundException, SQLException, Exception {
System.out.println("Hello");
establishConnection();
}
private void establishConnection() throws ClassNotFoundException, SQLException, Exception {
try{
Class.forName("com.mysql.jdbc.Driver");
conn= DriverManager.getConnection("jdbc:mysql://localhost:3306/exam_system?zeroDateTimeBehavior=CONVERT_TO_NULL","root","root");
}
catch(Exception e)
{
System.out.println(e);
}
}
请帮帮我
暂无答案!
目前还没有任何答案,快来回答吧!