9 Replies Latest reply on Oct 12, 2011 7:52 PM by hantsy

    SEAM event for "validation failed"

    captainvoid

      Hi,
      in SEAM 2 one could observe an event org.jboss.seam.validationFailed in order to be notified when JSF validation failed.
      Can somebody tell me if there's an equivalent in SEAM 3 ?
      I'm trying to migrate my application to SEAM 3 and don't know how to handle this.
      Thanks for any tip!

        • 1. Re: SEAM event for "validation failed"
          lightguard

          I don't remember off the top of my head if there is an event to listen to. If there is one, it'll be in the Faces module. If there isn't, would you please create a JIRA issue for this?

          • 2. Re: SEAM event for "validation failed"
            hantsy

            I tried to add an exceptionhandle to process the validation exception(added a global faces message), but it does not work as expected. 

            • 3. Re: SEAM event for "validation failed"
              lightguard

              That's great Hantsy, a little more info please? The exception you're getting, handlers, etc. Maybe debug the Seam Faces module a little bit and give us some more info.

              • 4. Re: SEAM event for "validation failed"
                hantsy

                I use a exceptionhandle like this. I wanted to add a global message when validation was failed.


                @HandlesExceptions
                public class GeneralExceptionHandler {
                
                     @Inject
                     Messages messages;
                
                     public void catchValidationException(
                               @Handles CaughtException<ConstraintViolationException> event, Logger log) {
                          log.info("Exception logged by seam-catch catcher: "
                                    + event.getException().getMessage());
                          messages.error(new DefaultBundleKey("validation_failed")).defaults(
                                    "Validation failed");
                     }
                



                But it did not work.

                • 5. Re: SEAM event for "validation failed"
                  lightguard

                  hantsy bai wrote on Oct 12, 2011 02:48:


                  I use a exceptionhandle like this. I wanted to add a global message when validation was failed.

                  @HandlesExceptions
                  public class GeneralExceptionHandler {
                  
                       @Inject
                       Messages messages;
                  
                       public void catchValidationException(
                                 @Handles CaughtException<ConstraintViolationException> event, Logger log) {
                            log.info("Exception logged by seam-catch catcher: "
                                      + event.getException().getMessage());
                            messages.error(new DefaultBundleKey("validation_failed")).defaults(
                                      "Validation failed");
                       }
                  



                  But it did not work.


                  Is a ConstraintViolationException not what's thrown? It seems odd that this wouldn't be caught. The only thing I could offer you is to debug into the exception handling classes of Seam Faces and see what's going on there.

                  • 6. Re: SEAM event for "validation failed"
                    hantsy

                    I got a debug info in the console.


                    21:09:03,870 INFO  [org.jboss.seam.faces.exception.CatchExceptionHandlerFactory] (http--127.0.0.1-8080-8) Catch not available, Catch integration disabled
                    
                    



                    PS:I used Seam 3.1.0 Beta3 and Jboss 7.0.1Final.

                    • 7. Re: SEAM event for "validation failed"
                      lightguard

                      Oops. Looks like we missed something when we moved Catch to Solder, sorry about that. We'll get that fixed for the next release.

                      • 8. Re: SEAM event for "validation failed"
                        lightguard

                        Hm, looks like it's there, what libraries do you have in your app?

                        • 9. Re: SEAM event for "validation failed"
                          hantsy

                          I replaced the catch with solder in pom.xml when upgraded to 3.1.0.Beta3