Typically, when a user uses a tag f:validatorfor a component, this validator will be called during the life cycle event phase before the values are applied on the server side. When the pending value passes validation, it will be used as the value for the component. If it does not pass the check, the value will be discarded, and a check message will usually be added.
, , , , , .
, PreRender :
<f:event listener="#{manageBean.preRenderValidation}" type="preRenderView" />
bean .
public void preRenderValidation() {
if (failed) {
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "You have a validation error", null);
getCurrentFacesContextInstance().addMessage(null, msg);
}
}
, preRender, , , , . , - .
share