在JSF页面加载时设置布尔值false

时间:2015-02-27 11:13:01

标签: jsf primefaces spring-security

下面是我的命令按钮,还有一个关于在页面加载时重置用户名和密码的null值的代码,但是当我获得访问被拒绝错误时,访问boolean变为true并出现错误消息如何在刷新页面时再次将其设为false,我尝试将setAccess(false)添加到loginReset()方法,但拒绝访问时不会显示任何消息 你能帮我么 ? 感谢

<c:if test="${not empty SPRING_SECURITY_LAST_EXCEPTION or customAuthenticationProvider.access == true}"
    scope="session">
    <h:outputLabel value="#{msg['invalidUsernamePassword']}"
                   id="access" styleClass="panelGrid2" /><br />
</c:if>

<p:commandButton id="login" action="login" type="submit"
                 actionListener="#{customAuthenticationProvider.loginn}"
                 ajax="false" value="#{msg['login']}" update="panelform"
                 style="font-size: 14px; width: 130px; height:30px">
</p:commandButton>

<f:event listener="#{customAuthenticationProvider.loginReset}" type="preRenderView" />
public void loginReset() {

    if (!FacesContext.getCurrentInstance().isPostback()) {
        System.out.println("loginReset");

        setUsername(null);
        setPassword(null);

    }
}

0 个答案:

没有答案