How to trigger args.validationFailed in PrimeFaces oncomplete

If utilizing the JSF-builtin validation facility (i.e. just use validators which throw ValidatorException the usual way with therein the desired faces message) is really not an option for some reason (I’d really think twice, no, thrice about working around JSF validation facility), then you can always use FacesContext#validationFailed() to signal JSF that the validation has failed in general, which is exactly what JSF validation facility is doing under the covers when a ValidatorException is caught.

FacesContext.getCurrentInstance().validationFailed();

Leave a Comment