Re: Partial Validation
I'm sure that other people would be interested... The best way to share your enhancement would be to set it up as a standalone project that operates as a struts2-plugin. Make the project available through googlecode, sourceforge or java.net. Then, register it as a struts2-plugin over here - https://cwiki.apache.org/confluence/display/S2PLUGINS/Home -Wes On Wed, Apr 28, 2010 at 1:58 AM, Rahul Mohan wrote: > Thanks for your comments Wes. > > I do have different action methods which I am invoking through wild-card > mappings. But I do not want to repeat the same validations in page level > submits and partial submits. I have implemented another solution with a > little bit of S2 customization. > > - Introduced a new annotation to group fields on the action class. For > example: > @Group("CustomerAddress") private int cityCode; > > - Introduced a group validation annotation to validate fields of only one > group from the class. Example: > �...@validate("CustomerAddres") > public String saveAddress() { > > } > > - Implemented a GroupValidatorManager extends > AnnotationActionValidatorManager (S2 internal) and introduced that instead > of the AnnotationValidationManager in struts xml as the default bean: > "com.opensymphony.xwork2.validator.ActionValidatorManager" > class="com.tcs.gui.arch.validation.GroupValidatorManager" > /> > > - GroupValidatorManager overrides the getValidator to return only the > applicable validators for the current method by processing the > annotations. > > I can share this code if anyone is interested. > > - Rahul > > > > From: > Wes Wannemacher > To: > Struts Users Mailing List > Date: > 27-04-2010 21:12 > Subject: > Re: Partial Validation > > > > When you submit the fieldset through ajax, are you submitting to a > different action mapping? If the ajax submit and the full form submit, > you could setup a validation for the action mapping that corresponds > to the ajax submit. Handling ajax validation is a bit tricky, but > somewhere in the wiki, there is a document that describes it. > > -Wes > > On Wed, Apr 21, 2010 at 3:35 AM, Rahul Mohan wrote: >> Hi, >> >> Is there any way I can do a partial validation in Struts 2? I have a > page >> with two fieldsets, where I can either submit the entire page or submit >> only the fieldset (through Ajax). In the latter case, I wish to validate >> only the fieldset's properties, but in the former case I want the entire >> page to be validated. I am using annotation for validation. >> >> Regards, >> Rahul >> =-=-= >> Notice: The information contained in this e-mail >> message and/or attachments to it may contain >> confidential or privileged information. If you are >> not the intended recipient, any dissemination, use, >> review, distribution, printing or copying of the >> information contained in this e-mail message >> and/or attachments to it are strictly prohibited. If >> you have received this communication in error, >> please notify us by reply e-mail or telephone and >> immediately and permanently delete the message >> and any attachments. Thank you >> >> >> > > > > -- > Wes Wannemacher > > Head Engineer, WanTii, Inc. > Need Training? Struts, Spring, Maven, Tomcat... > Ask me for a quote! > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > > =-=-= > Notice: The information contained in this e-mail > message and/or attachments to it may contain > confidential or privileged information. If you are > not the intended recipient, any dissemination, use, > review, distribution, printing or copying of the > information contained in this e-mail message > and/or attachments to it are strictly prohibited. If > you have received this communication in error, > please notify us by reply e-mail or telephone and > immediately and permanently delete the message > and any attachments. Thank you > > > -- Wes Wannemacher Head Engineer, WanTii, Inc. Need Training? Struts, Spring, Maven, Tomcat... Ask me for a quote! - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Partial Validation
Thanks for your comments Wes. I do have different action methods which I am invoking through wild-card mappings. But I do not want to repeat the same validations in page level submits and partial submits. I have implemented another solution with a little bit of S2 customization. - Introduced a new annotation to group fields on the action class. For example: @Group("CustomerAddress") private int cityCode; - Introduced a group validation annotation to validate fields of only one group from the class. Example: @Validate("CustomerAddres") public String saveAddress() { } - Implemented a GroupValidatorManager extends AnnotationActionValidatorManager (S2 internal) and introduced that instead of the AnnotationValidationManager in struts xml as the default bean: - GroupValidatorManager overrides the getValidator to return only the applicable validators for the current method by processing the annotations. I can share this code if anyone is interested. - Rahul From: Wes Wannemacher To: Struts Users Mailing List Date: 27-04-2010 21:12 Subject: Re: Partial Validation When you submit the fieldset through ajax, are you submitting to a different action mapping? If the ajax submit and the full form submit, you could setup a validation for the action mapping that corresponds to the ajax submit. Handling ajax validation is a bit tricky, but somewhere in the wiki, there is a document that describes it. -Wes On Wed, Apr 21, 2010 at 3:35 AM, Rahul Mohan wrote: > Hi, > > Is there any way I can do a partial validation in Struts 2? I have a page > with two fieldsets, where I can either submit the entire page or submit > only the fieldset (through Ajax). In the latter case, I wish to validate > only the fieldset's properties, but in the former case I want the entire > page to be validated. I am using annotation for validation. > > Regards, > Rahul > =-=-= > Notice: The information contained in this e-mail > message and/or attachments to it may contain > confidential or privileged information. If you are > not the intended recipient, any dissemination, use, > review, distribution, printing or copying of the > information contained in this e-mail message > and/or attachments to it are strictly prohibited. If > you have received this communication in error, > please notify us by reply e-mail or telephone and > immediately and permanently delete the message > and any attachments. Thank you > > > -- Wes Wannemacher Head Engineer, WanTii, Inc. Need Training? Struts, Spring, Maven, Tomcat... Ask me for a quote! - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org =-=-= Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you
Re: Partial Validation
When you submit the fieldset through ajax, are you submitting to a different action mapping? If the ajax submit and the full form submit, you could setup a validation for the action mapping that corresponds to the ajax submit. Handling ajax validation is a bit tricky, but somewhere in the wiki, there is a document that describes it. -Wes On Wed, Apr 21, 2010 at 3:35 AM, Rahul Mohan wrote: > Hi, > > Is there any way I can do a partial validation in Struts 2? I have a page > with two fieldsets, where I can either submit the entire page or submit > only the fieldset (through Ajax). In the latter case, I wish to validate > only the fieldset's properties, but in the former case I want the entire > page to be validated. I am using annotation for validation. > > Regards, > Rahul > =-=-= > Notice: The information contained in this e-mail > message and/or attachments to it may contain > confidential or privileged information. If you are > not the intended recipient, any dissemination, use, > review, distribution, printing or copying of the > information contained in this e-mail message > and/or attachments to it are strictly prohibited. If > you have received this communication in error, > please notify us by reply e-mail or telephone and > immediately and permanently delete the message > and any attachments. Thank you > > > -- Wes Wannemacher Head Engineer, WanTii, Inc. Need Training? Struts, Spring, Maven, Tomcat... Ask me for a quote! - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org