[OmniFaces utilities] The
validationFailed()
method signals JSF that the validations phase of the current request has failed. This can be invoked in any other phase than the validations phase. The value can be read by isValidationFailed()
in Java and by facesContext.validationFailed()
in EL.[OmniFaces utilities] The
isValidationFailed()
method returns whether the validations phase of the current request has failed.Method:
See also: Faces#getContext()
Usage:
JSF allows
us to programmatically signal that validation failed via FacesContext#validationFailed()
method. Basically, this method sets a flag, named validationFailed, which is
by default false.
For example, when an input validation fails in Process Validations phase, JSF
will invoke this method, as below:
FacesContext
fc = FacesContext.getCurrentInstance();
fc.validationFailed();
OmniFaces
comes with a shortcut for this method, named Faces#validationFailed().
import
org.omnifaces.util.Faces;
...
Faces.validationFailed();
or,
import
static org.omnifaces.util.Faces.validationFailed;
...
validationFailed();
OmniFaces
also comes with an OmniFaces utilities that returns the value of the validationFailed
flag, named Faces#isValidationFailed().
Method:
See also: Faces#getContext()
Usage:
import
org.omnifaces.util.Faces;
...
boolean
isvalidationfailed = Faces.isValidationFailed();
or,
import
static org.omnifaces.util.Faces.isValidationFailed;
...
boolean
isvalidationfailed = isValidationFailed();
This method
is a shortcut for plain JSF:
FacesContext
fc = FacesContext.getCurrentInstance();
boolean
isvalidationfailed = fc.isValidationFailed();
Niciun comentariu :
Trimiteți un comentariu