JSF List of Validation Errors
===

what is the best practise to validate an object against different validation rules and display all of them.

throwing multiple ValidationException and Displays them in an < h:messages /> tag.

I have a class like this:

    public class DossierService(){
        
         public void validateDossier(Dossier dossier) throws DossierException{
              boolean validationError = false;
              DossierException exception = new DossierException(dossier);
              if(dossier.getNom()==null){
                 validationErrror=true;
                 exception.addValidationError(new NomRequiredException());
              }
              
              /*
               +other tests.....
              if( ... ){
              }
              */

              if(validationError){
                  thow exception;
              }
         }
    }

    public class DossierException extends Exception {
       List<Exception> exceptions;
       public void addValidationError(Exception e){
          exceptions.add(e);
       }
       //getter and setters
    }

     // this is the backing bean class

     public class DossierBean (){
    
         public String closeDossier(){
           DossierService service = new DossierService();
           try{
               service.validateDossier();
           }
           catch(DossierException e){
               for(Exception e1: e.getExceptions()){
                   //throws ValidationExceptions for jsf framework
               }
           }

           //TODO

           return "";
         }
    }