Something like (and I completely don't know the JAXB API) public class JaxbFieldValidator extends FieldValidatorSupport {
public void validate(Object object) throws ValidationException { String fieldName = getFieldName(); String fieldValue = this.getFieldValue(fieldName, object); // making this up // associate our adapter class with Jaxb to get the error messages Jaxb.setErrorHandler(new JaxbErrorAdapter(fieldName, getValidatorContext())); // do the Jaxb mapping to beans - any errors should be propogated to the ValidatorContext (usually your Action) Jaxb.doWhatever(); } /** * Implement the Jaxb error interface */ private class JaxbErrorAdapter implements JaxbErrorHandler { private String propertyName; private ValidatorContext context; JaxbErrorAdapter(String propertyName, ValidatorContext context) { this.propertyName = propertyName; this.context = context; } /** * Implement the JAXB error methods here - this will put them into the context */ addError(String message) { context.addFieldError(message); } } } This could all be done in your Action too, and just have it add the error messages directly with this kind of adapter, or use it in a validator, etc... Depends on whether you want to use these beans after, or if you're just checking that the XML is ok... Jason > -----Original Message----- > From: Adam Sherman [mailto:[EMAIL PROTECTED] > Sent: Monday, October 27, 2003 1:01 PM > To: [EMAIL PROTECTED] > Cc: Jason Carreira > Subject: RE: [OS-webwork] Custom Validation (WW2) > > > On 10/27/03 09:45:26 -0600 Jason Carreira wrote: > > > You > > just need an adapter which can translate its errors into error > > messages which can go into a ValidationContext... > > This is exactly the comment I was after. Can you please give > me some more > detail? Implementation ideas? Etc... > > Basically, I'm using JAXB-generated classes as form beans. > This way my > backend and front-end are speaking the same language. Tests > have shown this > to work very well. > > Thanks for your comments, I'll go study the Javadoc. > > Cheers, > > A. > > -- > Adam Sherman > Tritus CG Inc > +1 (613) 797-6819 > http://www.tritus.ca/ > > ------------------------------------------------------- This SF.net email is sponsored by: The SF.net Donation Program. Do you like what SourceForge.net is doing for the Open Source Community? Make a contribution, and help us add new features and functionality. Click here: http://sourceforge.net/donate/ _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork