package dd;
import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class Servlet extends HttpServlet {

	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		 doPost(request,response);

	}

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		String name=request.getParameter("name");
		String pwd=request.getParameter("pwd");
  
		 
		    if(name.equals("jack_booth")){
			request.setAttribute("USER","<script>alert('此网名已有人注册，请另取!')</script>");
		    }
		    else
		    request.setAttribute("USER","<script>alert('此网名可以注册!!')</script>");
	 
	   RequestDispatcher dis=getServletContext().getRequestDispatcher("/index.jsp");
		 dis.forward(request,response);
			 
	}

	
}
