我的beanLogIn
类是requestdscoped。我想做的是,如果用户信息是有效的,oncomplete
或立即将boolean validUser (pessoaValida)
发送给beanHome
。但这行不通。为什么?是代码错误还是会话在完成之前刚刚关闭?
<h:commandButton value="Log In" action="#{beanLogIn.verificarLogIn()}" immediate="#
{beanHome.verificarUsuario(beanLogIn.pessoaValida)}"
试试这个,应该可以。
<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
}
}