Custom Grid Check

I am using directfaces 3.0. I have three text fields, one of which is required. How can I check this in simple fonts. please help .. thanks

+3
source share
1 answer

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() {
    // validation logic
    if (failed) {
      FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "You have a validation error", null);
      getCurrentFacesContextInstance().addMessage(null, msg);
    }
    // If action redirects to another page or state needs reverted back then this must be done
    // manually
}

, preRender, , , , . , - .

+6

All Articles