私は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>
しかし一度右の資格情報を入力した後、それだけでモード「でログイン」に留まり、そして私は、サーバーを再起動したときには、再度ログインする私を求められません。
彼ら(何かがFacesContext
について間違っていたとして、最後の1を除く)私は
HttpSession session=request.getSession(); session.invalidate();
などHow to properly logout of a Java EE 6 Web Application after logging inに
<% request.getSession().invalidate(); request.getSession(false); %>
とも答えを使って試してみましたすべて動作していないようです。だから私の質問はどのようにログアウトするのですか?私の構造に問題はありますか?すべての助けに感謝します。