This discussion is archived
3 Replies Latest reply: May 22, 2012 6:46 AM by Sudipto Desmukh RSS

how to prevent popup dialog from closing

MarioK Newbie
Currently Being Moderated
i have a Ok/Cancel popup dialog used to edit a selected row.
Ok button is doing a commit operation.
I have to prevent a dialog from closing when a database reports an ora exception.
Following one of Code corner's examples, I tried to show FacesMessage which should prevent closing:
    public void editRowDialogListener(DialogEvent dialogEvent) {
        if (dialogEvent.getOutcome().name().equals("ok")) {
            BindingContainer bindings = getBindings();
            OperationBinding operationBinding = bindings.getOperationBinding("Commit");
            Object result = operationBinding.execute();
            if (!operationBinding.getErrors().isEmpty()) { 
                FacesContext fctx = FacesContext.getCurrentInstance();
                FacesMessage fm = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Transaction Failed", "DB Error");
                UIComponent inputText = popupBinding.findComponent("it1");
                fctx.addMessage(inputText.getId(), fm);
Unfortunally a message is displayed AFTER popup is being closed.
Does anybody have an alternative solution for an issue?


  • Correct Answers - 10 points
  • Helpful Answers - 5 points