简体   繁体   中英

close richfaces popupPanel if method call has certain outcome

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?

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()"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM