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.


About this entry