日期:2014-05-17 浏览次数:20832 次
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setContentType("text/html");
UserDao ud=new UserDao();
String username=request.getParameter("user");
String userpassword=request.getParameter("pwd");
boolean flag=ud.sel(username);
System.out.println(username);
System.out.println(userpassword);
System.out.println(flag);
PrintWriter out = response.getWriter();
if(flag){
out.print("The user name has been registered!");
}else{
out.print("<script>window.location.href='login.jsp';</script>");
//response.sendRedirect("login.jsp");
}
}
if(flag){
out.print("The user name has been registered!");
}else{
//out.print("<script>window.location.href='login.jsp';</script>");
response.sendRedirect("login.jsp");
}