【发布时间】:2014-07-05 05:44:55
【问题描述】:
我正在使用下面的代码进行注销
public String logout() throws ServletException {
cleanSession();
FacesContext.getCurrentInstance().getExternalContext()
.invalidateSession();
HttpServletRequest request = (HttpServletRequest) FacesContext
.getCurrentInstance().getExternalContext().getRequest();
FacesContext.getCurrentInstance().getExternalContext()
.invalidateSession();
return "Logout";
}
Logout.xhtml 页面位于 login 文件夹中,但我最终得到了
无法找到与 from-view-id 匹配的导航案例 '/core/dashboard.xhtml' 用于操作 '#{loginBean.logout}' 的结果 '退出'
我尝试了 Stackoverflow 中提供的最大解决方案,但无法获得解决方案..我也尝试了以下代码
public String logout() throws ServletException {
cleanSession();
FacesContext.getCurrentInstance().getExternalContext()
.invalidateSession();
HttpServletRequest request = (HttpServletRequest) FacesContext
.getCurrentInstance().getExternalContext().getRequest();
FacesContext.getCurrentInstance().getExternalContext()
.invalidateSession();
try {
String action = request.getContextPath()
+ "/login/Logout.xhtml";
return action;
} catch (Exception e) {
LOG.error("Exception in forwarding at Logout", e);
}
return null;
}
但同样的问题..谁能告诉我是什么问题?
我稍作改动并添加了这个
<p:commandLink ajax="false" rendered="#{loginBean.loginStatus}"
value="Logout" actionListener="#{loginBean.logout}" action="Logout">
</p:commandLink>
以前是这样的
<p:commandLink ajax="false" rendered="#{loginBean.loginStatus}"
value="Logout" action="#{loginBean.logout}"
>
</p:commandLink>
【问题讨论】: