我在我的应用程序中使用了一个(Primefaces 3.5)注销按钮,如下所示:
<p:commandButton ajax="false" value="Logout" action="#{loginBean.logout}" />
bean 方法如下所示:
public String logout() {
ExternalContext externalContext =
FacesContext.getCurrentInstance().getExternalContext();
HttpServletRequest request = (HttpServletRequest) externalContext.getRequest();
try {
request.logout();
System.out.println("Logging out!");
return "/mylogin?faces-redirect=true";
} catch (ServletException ex) {
System.out.println("Failed to logout!");
return null;
}
}
字符串 Logging out! 打印正确,但未执行重定向!
只有当我再次单击注销按钮时,登录页面才会再次显示?
为什么?
问候, G.Verhaag