Search code examples
javaservletshttpsession

Java Servlets and HttpSessions


Very basic question. I have a portal containing several servlets, one of which takes care of logging in (but only as an admin). How do I use HttpSessions between Servlets to know if the admin is signed in?

Thanks in advance!


Solution

  • set an attribute in session

    session.setAttribute("isAdmin",true OR false);
    

    At the login time decide the user type and set it.