i m using jsf2 and i have problem with logout.
In fact to connect to my application the url is
http://localhost:8080/myapplication/
here is the 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 with authentification, i m redirect to 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 is my main page.
then i have add a LoginBean with :
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 i click logout, i m redirect to :
http://localhost:8080/myapplication/login.jsp
but when i try to re-login, login page is show another time, so i try to login again, but i have error message :
Etat HTTP 404 - /castorsurveillance-web/j_security_check
does it possible, when i m logout to redirect to
http://localhost:8080/myapplication/
instead of
http://localhost:8080/myapplication/login.jsp
?
or another solution if a best one exist! :)
thanks!!