我需要在身份验证之前进行设置吗?
是的,当用户第一次访问login.jsp并成功进行身份验证时,您可以像这样创建此属性。 session.setAttribute(" authenticated",true);
登录页面位于主页中,因此从servlet进行身份验证之后,如果用户进入该主页并单击login.jsp,那么他将被重定向到home.jsp吗?
是的。如果authenticated属性设置为true,则用户将被重定向到home.jsp。还有一点,一旦用户登录,就需要隐藏login.jsp的链接
感谢您的回复。我要写这个session.setAttribute(" authenticated",true);在login.jsp中还是我需要写一些额外的内容?
您需要编写session.setAttribute(" authenticated",true);在验证用户身份之后。我猜你在servlet中进行身份验证,所以在那做。
是的,我正在通过Servlet进行身份验证,因此成功身份验证后,我将编写:session.setAttribute(" authenticated",true); response.sendRedirect(" home.jsp");在那个servlet中?否则我将编写session.setAttribute(" authenticated",true);在login.jsp页面中?但是在这个login.jsp页面中,我如何创建session.setAttribute(" authenticated",true);