best approach to do jsf form validation

Posted by gurupriyan.e on Stack Overflow See other posts from Stack Overflow or by gurupriyan.e
Published on 2010-05-24T15:48:47Z Indexed on 2010/05/24 15:51 UTC
Read the original article Hit count: 247

Filed under:

If I have many input controls in a form (There are separate validators for each of these input controls - like required,length and so on ) , there is a command button which submits the form and calls an action method. The requirement is - though the input control values are , say , individually okay - the combination of these values should be okay to process them together after the form submission - Where do i place the code to validate them together?

1) Can i add a custom validator for the command button and validate the combination together? like validate(FacesContext arg0, UIComponent arg1, Object value) but even then I will not have values of the other input controls except for the command button's/component's value right ?

2) can i do the validation of the combination in the action method and add validation messages using FacesMessage ?

or do you suggest any other approach?

Thanks for your time.

© Stack Overflow or respective owner

Related posts about jsf