Session JSF注销删除会话

Session JSF注销删除会话,session,jsf,weblogic,login-control,Session,Jsf,Weblogic,Login Control,我正在EclipseIDE上开发一个基于jsf的web应用程序。我在登录和注销操作方面遇到了一些问题。A.S是一种网络逻辑。我可以成功登录和注销应用程序,但以下代码不会破坏会话…: 我的注销功能 public String logout() throws IOException { FacesContext context = FacesContenter code hereext.getCurrentInstance(); ExternalContext ec = contex

我正在EclipseIDE上开发一个基于jsf的web应用程序。我在登录和注销操作方面遇到了一些问题。A.S是一种网络逻辑。我可以成功登录和注销应用程序,但以下代码不会破坏会话…:

我的注销功能

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>

/home.xhtml
注销
/login.xhtml
日志记录的主页

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


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

你好
#{profileController.profile.name}

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>

Facesservlet
javax.faces.webapp.FacesServlet
1.
Facesservlet
*.jsf
com.sun.faces.enableRestoreView11兼容性
真的

您看到的页面很可能来自浏览器缓存。您可以禁用某些或所有页面的缓存。有关详细信息,请参阅此图。

注销后不要删除用户会话。在这张图片中,我尝试按firefox后退按钮,但会话未删除![会话未删除][1]:如何禁用缓存所有页面?如何禁用缓存Matt Handy先生?您不需要删除整个浏览器缓存。您只需确保页面不会被缓存。点击我答案中的链接。有一个可能的解决方案,您可以根据自己的目的进行调整。我对您建议的解决方案没有任何设想。但我会尝试这样做。您能告诉我更多信息吗。这个链接有很多内容。但我不理解。非常抱歉。帮助我。我应该写过滤器类?是的,你需要一个过滤器。有关更多信息,请参见过滤器。