java - JSF2 form based authentification logout -


i m using jsf2 , have problem logout.

in fact connect application url

http://localhost:8080/myapplication/

here configuration :

login.jsp

<form method="post" action="j_security_check">             <table>                 <tr>                     <td>nni :</td>                     <td><input type="text" name="j_username"/></td>                 </tr>                 <tr>                     <td>mot de passe :</td>                     <td><input type="password" name="j_password"/></td>                 </tr>                 <tr>                     <td colspan="2" align="right"><input type="submit" value="identifier"></td>                 </tr>             </table>         </form> 

web.xml

<login-config>     <auth-method>form</auth-method>     <form-login-config>         <form-login-page>/login.jsp</form-login-page>         <form-error-page>/login_failed.jsp</form-error-page>     </form-login-config> </login-config> 

all work fine authentification, m redirect index.jsp

index.jsp

<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head></head>     <body>         <jsp:forward page="/pages/start.jsf" />          </body> </html> 

and start.xhtml main page.

then have add loginbean :

public string logout() throws ioexception {      facescontext facescontext = facescontext.getcurrentinstance();     externalcontext externalcontext = facescontext.getexternalcontext();     externalcontext.invalidatesession();      return "logout"; } 

and in faces-config.xml

<navigation-rule>     <from-view-id>/*</from-view-id>     <navigation-case>         <from-outcome>logout</from-outcome>         <to-view-id>/login.xhtml</to-view-id>         <redirect/>     </navigation-case> </navigation-rule> 

and when click logout, m redirect :

http://localhost:8080/myapplication/login.jsp

but when try re-login, login page show time, try login again, have error message :

etat http 404 - /castorsurveillance-web/j_security_check 

does possible, when m logout redirect

http://localhost:8080/myapplication/ 

instead of

http://localhost:8080/myapplication/login.jsp  

?

or solution if best 1 exist! :)

thanks!!


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -