The current usage of Annotating methods seems broken. Its still applying all the validation rules to all methods despite methods having different validation requirements.
The Struts "Zero Config/Annotation/Auto Config needs help" Hopefully, a http://jira.opensymphony.com/browse/XW-603 sprinkling of sane configuration of inheritance (though xml) will add power, and reduce redundant configuration code. re: http://jira.opensymphony.com/browse/XW-603 Matt Ealden Escañan wrote: > > On Tue, Mar 11, 2008 at 7:10 AM, xianwinwin <[EMAIL PROTECTED]> wrote: >> >> assuming registration is composed of fname, lname, ss, dob and except dob >> all fields are mandatory. >> >> Question: how do I make sure those fields will be input? should I have >> something like: >> >> @RequiredStringValidator(message="Legal Name is missing") >> private setFname(String fn) >> >> on the registration - if so - wouldn't that effect other classes that >> uses >> registration??? >> >> thanks for any input! > > Hi xianwinwin, > > You can annotate an action method with @Validations and validate from > there, ie: > > @Validations( > requiredString = { > @RequiredFieldValidator( > type=ValidatorType.FIELD, > fieldName="registration.fname" > message="Foo!" > ) > } > ) > public String save() { ... } > > http://struts.apache.org/2.x/docs/validation-annotation.html > > Admittedly, I used this approach these past few days and found myself > back to validations in XML: > http://blog.ealden.net/2008/03/working-with-struts-2-validators.html > > Thanks > > -- > Ealden Esto E. Escañan > http://blog.ealden.net > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/validation-with-annotation-tp15966492p16039860.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]