If you have the Car object as a property of the Action, you can use the VisitorFieldValidator (there's a little doc on this on the Wiki) to make the validation framework use the validations defined for the Car class. This way, you could define your common validations for the car in a single Car-validations.xml. You could also define context-specific validations for Car by creating Car-edit-validation.xml and Car-create-validation.xml and set the context in the VisitorFieldValidator declaration, like this:
<field name="car"> <field-validator type="visitor"> <param name="context">anotherContext</param> <message>car: </message> </field-validator> </field> Here, the message element defines the text which is prepended to the messages added by the validators for the subproperty (car in this case). The VisitorFieldValidator can also be applied to Collections and Arrays of objects and will run for each. Jason > -----Original Message----- > From: Francisco Hernandez [mailto:[EMAIL PROTECTED] > Sent: Friday, September 05, 2003 5:41 AM > To: [EMAIL PROTECTED] > Subject: [OS-webwork] using one validator on several different actions > > > I've been using the validator in webwork and have found myself > duplicating a few of the validations throughout the app, is > there anyway > I can apply validations to multiple actions or objects? > > for example I have a creation form to create a Car, and then I have > another to Edit and Update the Car, how could I create just one > validation file that will validate that Car? > > right now I've got 2 validation files, CreateCarAction-validation.xml > and UpdateCarAction-validation.xml and both are identical. > > im thinking maybe a way to specify what validation files to > use in the > action mapping? what do you guys think > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Opensymphony-webwork mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork