java web中不弹出错误提示框
protectedvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)throwsServl...
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
HttpSession session = request.getSession();
String name = request.getParameter("user");
String pass = request.getParameter("password");
String type = request.getParameter("type");
boolean f = false;
if(pass!=null&&name!=null){
if(type.equals("admin")){
f = new logincheck().check(name, pass);
}else{
f = new logincheck1().check(name, pass);
}
}
if(f){
session.setAttribute("name", name);
session.setAttribute("pass", pass);
ServletContext app = this.getServletContext();
RequestDispatcher rd = app.getRequestDispatcher("/index.jsp");
rd.forward(request, response);
}
else{
request.setAttribute("error", "用户名或密码错误!");
request.getRequestDispatcher("/login.jsp").forward(request, response);
}
}
我的dopost方法 为什么打了错误的用户名和密码,它不弹出错误提示框
求大神解答 JAVA新人拜谢 展开
throws ServletException, IOException {
HttpSession session = request.getSession();
String name = request.getParameter("user");
String pass = request.getParameter("password");
String type = request.getParameter("type");
boolean f = false;
if(pass!=null&&name!=null){
if(type.equals("admin")){
f = new logincheck().check(name, pass);
}else{
f = new logincheck1().check(name, pass);
}
}
if(f){
session.setAttribute("name", name);
session.setAttribute("pass", pass);
ServletContext app = this.getServletContext();
RequestDispatcher rd = app.getRequestDispatcher("/index.jsp");
rd.forward(request, response);
}
else{
request.setAttribute("error", "用户名或密码错误!");
request.getRequestDispatcher("/login.jsp").forward(request, response);
}
}
我的dopost方法 为什么打了错误的用户名和密码,它不弹出错误提示框
求大神解答 JAVA新人拜谢 展开
展开全部
没有捕获error吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询