Very simple question. I have a portal containing several servlets, one of which takes care of registration (but only as an administrator). How to use HttpSessions between servlets to find out if an administrator is signed?
Thanks in advance!
set attribute in session
session.setAttribute("isAdmin",true OR false);
At the time of logging in, select the user type and set it.
Whenever your administrators sign insert something like session.setAttribute ("admin", "true");
session.getAttribute( "admin" ), ,
I would save the full user object in the session.
http://download.oracle.com/javaee/1.3/api/javax/servlet/http/HttpServletRequest.html#getSession ()
You can access the session using this method. If you save the entire user in a session (or the user ID from your database), you can implement more advanced, role-based access later, as your application grows.
Hi
Source: https://habr.com/ru/post/1771957/More articles:Communication between Android emulators - androidWhat are the arguments for replacing keywords as a function in version control systems? - version-controlhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1771954/php-mail-function-sends-the-email-but-it-takes-more-than-10-mins-to-show-up&usg=ALkJrhhz93dG9KdnqLbtWvp3GlYuHgRPcAHow to prevent accidental authentication of Rails users as the wrong user? - securityКак я могу обработать событие щелчка динамически заполненного ul li? - jqueryСокращение массива на основе последовательных вхождений - arraysGet the given GMT and UTC offset date in python - pythonhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1771960/why-embedded-openejb-fails-to-deploy-my-application&usg=ALkJrhjqkXHJlnsPPUkYEE52d6CGavU_egFundamental .NET - How links are "saved / resolved" - pointersMongoDB GridFS, Rails 3, X-Sendfile and ACL, HOW-TO? - ruby-on-railsAll Articles