Nesting Seam Validation Tags

Here’s an interesting one that caused me to stumble for a while… If you are leveraging Seam’s field-level validation and are mixing it with Rich Faces components, you have to be conscious of how you nest your tags.

For example, this caused validation to be skipped:



    
        
            
                
            
            
                
            
        
        
    

When clicking on the save button, you will bypass validation and go directly to the save() method on the named component myService.

To fix this, you need to nest the tags within each tab panel:



        
            
            
                
            
            
            
            
                
            
            
        
        

Viola, now your required tags are properly enforced, as well as any Hibernate annotation validation that exists.

2 comments

  1. hi, this article of yours may solve my problem, but unfortunately I cannot view the codes you have sited. Can I request for a copy of this in my mail.

    Thanks a lot. Im really having problems in the validations

Comments are closed.