Pergunta

I'm trying to get build a simple Login Panel. The Panel is a rich:popupPanel. When the "Login" link/button is clicked I want the Panel to stay open if the login was unsuccessfull (due to wrong username/password, Database errors ... what ever). But the Panel should close if the login was successfull.

My best attempt looks like this, but the "oncomplete" value can not be parsed

<a4j:commandButton value="login" oncomplete="if (#{userController.login()}) #{rich:component('loginPanel')}.hide()"/>

How do I get that behavior from the popupPanel?

Foi útil?

Solução

You should use action property to invoke login method on your bean. The loginSuccess is a property indicating if login was successfull or not.

<a4j:commandButton value="login" action="#{userController.login}" oncomplete="if (#{userController.loginSuccess}) #{rich:component('loginPanel')}.hide()"/>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top