Advertisement
vim_fans

Untitled

Sep 6th, 2021
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. package SignUp;
  2. import java.io.IOException;
  3. import java.io.PrintWriter;
  4.  
  5. import javax.servlet.ServletException;
  6. import javax.servlet.annotation.WebServlet;
  7. import javax.servlet.http.HttpServlet;
  8. import javax.servlet.http.HttpServletRequest;
  9. import javax.servlet.http.HttpServletResponse;
  10. import org.apache.logging.log4j.LogManager;
  11. import org.apache.logging.log4j.Logger;
  12.  
  13. @WebServlet(urlPatterns = "/signup.do")
  14. public class SignUpServlet extends HttpServlet{
  15.  
  16. private static final Logger logger = LogManager.getLogger("SignUp");
  17.  
  18. protected void doGet(HttpServletRequest request, HttpServletResponse response)
  19. throws ServletException,IOException
  20. {
  21. logger.error("signup");
  22. request.getRequestDispatcher("/WEB-INF/views/signUp.jsp").forward(request, response);
  23.  
  24. }
  25.  
  26. protected void doPost(HttpServletRequest request, HttpServletResponse response)
  27. throws ServletException,IOException
  28. {
  29. PrintWriter out = response.getWriter();
  30. String userName = request.getParameter("username");
  31. String password = request.getParameter("password");
  32. String email = request.getParameter("email");
  33. String phone = request.getParameter("phone");
  34. SignUpService service = new SignUpService();
  35. if(service.customerSignUp(userName, password, email, phone)>0)
  36. {
  37. out.print("You are successfully registered");
  38. }
  39.  
  40.  
  41. }
  42. }
  43.  
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement