这里出现异常jsp+servlet代码protectedvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException,IOException{//TODOAuto-generatedmethodstubStri...
这里出现异常
jsp+servlet代码
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String email=request.getParameter("email");
String login=request.getParameter("login");
String password=request.getParameter("password");
String confirmpass=request.getParameter("confirmpass");
PrintWriter out=response.getWriter();
DBConnAccess DBConn=new DBConnAccess();
String dbpath = "test.mdb"; //
Connection conn = DBConn.getConnToAccess(request.getSession().getServletContext().getRealPath(dbpath));
Statement stmt=null;
ResultSet rs = null;
try {
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
String sql = "insert into username(email,login,pwd)values('"+email+"','"+login+"','"+password+"')";
out.println(login);
rs = stmt.executeQuery(sql);
out.println(login);
String selectsql="select *from username";
ResultSet rs1 = stmt.executeQuery(selectsql);
while (rs1.next()) {
out.println(rs.getString("login"));
}
} catch (Exception e) {
// TODO Auto-generated catch block
out.println(e);
e.printStackTrace();
}
DBConn.close();
regInfo.setMess("");
//验证成功调用ProcessData对象的update方法将注册信息添加入数据库
//regInfo.setMess("注册成功,请重新登录!");
//response.sendRedirect("signin.jsp");
//RequestDispatcher requestDispatcher=request.getRequestDispatcher("signshow.jsp");
//requestDispatcher.forward(request, response);
}
求教连接access
展开