JSF注销已删除的会话

时间:2012-04-30 03:37:15

标签: session jsf weblogic login-control

我正在Eclipse IDE上开发基于jsf的Web应用程序。我在登录和注销操作方面遇到了一些问题。 A.S是一个Weblogic。我可以成功登录并注销到应用程序,但是以下代码不会破坏会话......:

我的退出功能

public String logout() throws IOException {
    FacesContext context = FacesContenter code hereext.getCurrentInstance();
    ExternalContext ec = context.getExternalContext();
    final HttpServletRequest request = (HttpServletRequest) ec.getRequest();
    request.getSession(true).invalidate();
    return ("logout");
}

faces-config.xml中

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

记录主页

<body>
<h:form id="Form">
        Hello<span style="color: ORANGE">
            #{profileController.profile.name}</span>


    <h:commandLink value="sign out" action="#{profileController.logout}" />
</h:form>

Web.xml中

<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<context-param>
    <param-name>com.sun.faces.enableRestoreView11Compatibility</param-name>
    <param-value>true</param-value>
</context-param>

1 个答案:

答案 0 :(得分:1)

您看到的页面最有可能来自浏览器缓存。您可以为某些或所有页面禁用缓存。有关详细信息,请参阅此answer to a similar question