--- Dirk Schumacher wrote: > 2 fields/properties to be set on my Action: > startDate(String) > endDate(String) > > When setting a value first of all the String must be parsed into a Date > object.
FYI, that can be handled automatically by the framework via type conversion [1] unless there's some compelling reason to explicitly convert from a string. > I'd like to annotate the properties-setters, so an implementing > validator takes care of the validation. > > sth like this.: > @CustomizableS2Validator ( message="Insuffient Start Date", > when="before", otherDate="endDate" ) > public void setStartDate(String inDate) { > date = inDate; > } IIRC using an annotation for a custom validator is a bit more complicated than that because of how annotations work (they can't be subclassed) and XWork sets things up with regards to validation annotations. You'd probably have to use @CustomValidator [2]. > Is it possible to customize the parameters of an annotation? @ValidationParameter [3] sets parameters for @CustomValidator. I find it pretty unwieldy, but because of the way XWork looks for validation annotations I'm not sure what the options are at this point. Perhaps somebody else will have a better solution. Dave [1] http://struts.apache.org/2.x/docs/type-conversion.html [2] http://struts.apache.org/2.x/docs/customvalidator-annotation.html [3] http://struts.apache.org/2.x/docs/validationparameter-annotation.html --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]