Keep p:dialog open when a validation error occurs after submit

后端 未结 6 530
我在风中等你
我在风中等你 2020-11-22 15:22

Minimal example dialog:

 
  

        
6条回答
  •  心在旅途
    2020-11-22 15:51

    I've just googled up this solution. Basically the idea is to use actionListener instead of button's action, and in backing bean you add callback parameter which will be then check in button's oncomplete method. Sample partial code:

    JSF first:

    
    

    Backing bean:

    public void doAction(ActionEvent actionEvent) {
        // do your stuff here...
        if (ok) {
            RequestContext.getCurrentInstance().addCallbackParam("saved", true);
        } else {
            RequestContext.getCurrentInstance().addCallbackParam("saved", false);
        }
    }
    

    Hope this helps someone :)

提交回复
热议问题