怎么不用跳转到专门的失败界面而在登陆界面上直接显示登录失败?
我一共主要用到两个文件index.jsp用来设计登陆界面,login.jsp用来处理index.jsp提供的表单信息和数据库中进行比较判断。
具体怎么实现呢?具体具体
index.jsp:
login
户名[/B]
密码
login.jsp:
public class login extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setCharacterEncoding("utf-8");
PrintWriter out=null;
out=response.getWriter();
User user=new User();
String name=null;
String password=null;
name=request.getParameter("username");
password=request.getParameter("password");
/*if(name==null||name.equals(""))
{
out.print("");
}*/
Login ldao=new Login();
boolean flag=ldao.getLogin(name, password);
if(flag){
out.print("");
}else{
out.print("");
}
}
}
|