Uploaded image for project: 'Spring Web Flow'
  1. Spring Web Flow
  2. SWF-1490

FacesContext.isValidationFailed() should return true if Web Flow's MessageContext has errors

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 2.3.0
    • Fix Version/s: 2.3.1
    • Component/s: JSF
    • Labels:

      Description

      If I use a model validator in webflow and add an error message on the messageContext, the validationFailed flag on JSF will no be triggered. In some use cases (e.g. in a popup dialog), I need to know if validationFailed so I can hide the dialog.

      I've been able to accomplish this overriding the method viewRendering on FlowFacesContextLifecycleListener:

      @Override
      public void viewRendering(RequestContext context, View view, StateDefinition viewState) {
      	if (context.getMessageContext().hasErrorMessages()) {
      		FacesContext facesContext = FacesContext.getCurrentInstance();
      		if (facesContext != null) {
      			facesContext.validationFailed();
      		}
      	}
      }
      

        Attachments

          Activity

            People

            Assignee:
            rstoya05-aop Rossen Stoyanchev
            Reporter:
            yanaga Edson Yanaga
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: