这是一个有效的h:commandButton操作吗?

时间:2014-05-20 02:05:30

标签: jsf commandbutton

我的beanLogIn课程已被askScoped。我想要做的是,如果用户信息有效,oncomplete或立即将boolean validUser (pessoaValida)发送给beanHome。但这不起作用。为什么?代码是错误的还是会话在完成之前就关闭了?

 <h:commandButton value="Log In" action="#{beanLogIn.verificarLogIn()}" immediate="#      
 {beanHome.verificarUsuario(beanLogIn.pessoaValida)}"

1 个答案:

答案 0 :(得分:0)

试试这个,它应该有效。

 <h:commandButton value="Log In" action="#{beanLogIn.validateUser()}" />

@ManagedBean
@RequestScoped
public class BeanLogin {

    public String validateUser {
        // perform your validation logic
        return "beanHome?faces-redirect=true"; // here you should mention beanHome URL
    }

}