Guest User

Untitled

a guest
Apr 12th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  2.  
  3. String username = request.getParameter("username");
  4. String password = request.getParameter("password");
  5. Boolean action = true;
  6.  
  7. if (action){
  8. request.setAttribute("username", username);
  9. request.setAttribute("password", password);
  10.  
  11. RequestDispatcher redirect =request.getRequestDispatcher("registercustomer.jsp");
  12. redirect.forward(request,response);
  13. }else{
  14. request.setAttribute("username", username);
  15. request.setAttribute("messageResult", messageResult);
  16. RequestDispatcher redirect =request.getRequestDispatcher("registeruser.jsp");
  17. redirect.forward(request,response);
  18. }
  19. return;
  20. }
  21.  
  22. protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  23. String username = request.getParameter("username"); //get username from globals model
  24. String password = request.getParameter("password"); //get password from globals model
  25. String userrole = request.getParameter("userrole"); //get userrole from globals model
  26.  
  27. //put attributes from register user
  28. request.setAttribute("username", username);
  29. request.setAttribute("password", password);
  30. request.setAttribute("userrole", userrole);
  31.  
  32. RequestDispatcher dispacther = request.getRequestDispatcher("registercustomer.jsp");
  33. dispacther.forward(request, response);
  34. }
Add Comment
Please, Sign In to add comment