daily pastebin goal
67%
SHARE
TWEET

Untitled

a guest Jun 22nd, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. HttpSession session = request.getSession();
  2.  
  3.     UsersService usersService = new UsersService();
  4.     int id_user = usersService.getRoleUser(userName, password);
  5.     Calendars calendars = new Calendars();
  6.     if (id_user != 0) {
  7.         Users user = usersService.getUserById(id_user);
  8.         if (user.getRole().equals("user")) {
  9.             session.setAttribute("userName", userName);
  10.             session.setAttribute("name",user.getFio_user());
  11.             session.setAttribute("magazine",user.getMagazine());
  12.             session.setAttribute("id_user", id_user);
  13.             session.setAttribute("date_now", calendars.getNowDate());
  14.             response.sendRedirect("userview/user.jsp");
  15.         }
  16.         if (user.getRole().equals("admin")) {
  17.             response.sendRedirect("adminview/admin.jsp");
  18.         }
  19.     }else
  20.     {
  21.         response.sendRedirect("index.jsp");
  22.     }
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top