Я начинаю пытаться изучить jsp, создав страницу входа с помощью j_security_check.J_security_check сеанс не заканчивается
В следующем коде от web.xml
вы можете видеть, что все, что находится в защищенной папке, необходимо для входа в систему для доступа к ней.
<welcome-file-list>
<welcome-file>protected/home.jsp</welcome-file>
</welcome-file-list>
<security-constraint>
<display-name>Security Constraint</display-name>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<url-pattern>/protected/*</url-pattern>
<http-method>DELETE</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
</web-resource-collection>
<auth-constraint>
<role-name> manager </role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>Example Form-Based Authentication Area</realm-name>
<form-login-config>
<form-login-page>/protected/home.jsp</form-login-page>
<form-error-page>/error.jsp</form-error-page>
</form-login-config>
</login-config>
<security-role>
<description> An administrator </description>
<role-name> manager </role-name>
</security-role>
Однако после ввода правильных учетных данных один раз, он просто остается в «вошли в» режиме, и когда я перезапустить сервер не подсказывают мне снова войти в систему. Я попытался с помощью
HttpSession session=request.getSession(); session.invalidate();
, а также
<% request.getSession().invalidate(); request.getSession(false); %>
, а также ответы на How to properly logout of a Java EE 6 Web Application after logging in (за исключением последнего, когда что-то пошло не так в отношении FacesContext
)
но они все, похоже, не работают. Итак, мой вопрос: как выйти из системы? Есть ли проблемы в моей структуре? Вся помощь приветствуется.