0

当我单击注销按钮时,primefaces 的组件会在 login.xhtml 页面出现之前散布!该action属性调用该logout()函数。

logout()函数的源代码是:

public String logout() throws IOException
{
    HttpServletRequest request = ((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest());
    request.getSession().removeAttribute("userManager");
    request.getSession().invalidate();
    return "../login.xhtml";
}

<p:dock>在页面中使用了调用注销功能的项目组件,当我单击注销按钮时,图像(项目)垂直放置。

这是我的Login.xhtml页面:

<!DOCTYPE html>

<h:head> 
    <title>Login Page</title>

</h:head>
<h:body> 

    <h:form>
        Votre code alliance : #{loginBean.codeAliance} <br/> 
        <h:panelGrid columns="2" cellpadding="5" >  

            <h:outputLabel for="codeAliance" value="Code Aliance:" />  
            <p:inputText value="#{userManager.codeAliance}" id="codeAliance" required="true" label="codeAliance" />

            <h:outputLabel for="password" value="Password:" />  
            <p:password value="#{userManager.password}" id="password" required="true" label="password" />  

            <f:facet name="footer">  
                <p:commandButton id="loginButton" value="Login" action="#{userManager.connexion}" ajax="false"/>  
            </f:facet>  

        </h:panelGrid>             

    </h:form>
</h:body>

这是bienvenue.xhtml包含以下内容的页面<p:dock>

<!DOCTYPE html>

<h:head>
    <title>Premier exemple JSF 2.0</title>
</h:head>
<h:body>

    <h:form> 
        <p:dock position="top">  
            <p:menuitem value="Users" icon="/Images/Users.png" url="#"/>  
            <p:menuitem value="Quitter" icon="/Images/Logout.png" url="#"/>
            <p:menuitem value="Users" icon="/Images/Users.png" url="#"/>
            <p:menuitem value="Users" icon="/Images/Users.png" url="#"/> 

        </p:dock>
    </h:form>   
    <p:commandButton value="lyes" icon="/Images/Logout.png" action="#{userManager.logout}"/>
</h:body>

有人能帮我吗 !?

4

0 回答 0