I find that if a view contains very granular forms, then it is sometimes 
convenient for the same backing bean to handle several of these forms.  In 
other words:  a different action per form, where each action is on the same 
backing bean. 

This doesn't work well for server side Seam validation, though, because the 
validation on a single backing bean is not as granular as JSF forms.  
Essentially, all actions on the same bean marked @IfInvalid will do the exact 
same validation, letting Seam ultimately support just one form per backing bean.

A solution that allows Seam to handle multiple form validation in the same 
backing bean might be a notion of "validation groups":

- A new validation related annotation like 
@ValidGroup(name="ProductUpdateFields") that is coupled with each validated 
field/method such as @NotNull @ValidGroup(...).

- A new annotation called @IfGroupsInvalid that contains a list of the grouped 
validators to include in the validation process.  For example: @ 
IfGroupsInvalid(groups={'ProductUpdateFields'}).  You'd also need an optional 
parameter on this annotation like "includeDefault=false", so that you can tell 
it to include ungrouped validations.   In short, 
@IfGroupsInvalid(includeDefault=true, groups={}) would be semantically 
equivalent to the current @IfInvalid.

Then, only the validated fields/methods that are coupled with 
@ValidGroup(name="ProductUpdateFields") will get validated when coupled with 
@IfGroupsInvalid instead of @IfInvalid.

I'm not sure if anyone else is running into this, but I personally would find 
it pretty handy.  Of course there are ways around this using more granular 
beans, one bean per form in other words, but that's not very convenient in some 
situations, imo.

Ryan


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3912448#3912448

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3912448


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to