Hello out there,

I am relativley new to S2 and I got stuck on a validation problem.

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. I know how to handle that.
The endDate must be after the startDate. And that's the problem.

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;
}

Implementing a FieldValidatorSupport does not work because I only know how to access the validated property. But I need another property of the Action object.

I know it would be solveable by the @FieldExpressionValidator where its expression can be filled with a complex OGNL-Expression. But if evaluating the expression internally throws an Exception, the evaluation does not terminate right. (I'd be fine with a negative validation and re-jecting to the input page, but if the OGNL is not evaluateable it passes the validation)

Another way is to validate within the executed action method. I want a Validator. Yet, another is to implement a Validator which accesses Porperties via Reflection and analyzing the Annotations.

But I'd like to have a Validator object handling the validation concern.

Big question?
Is there even a way to do this.
Is it possible to customize the parameters of an annotation?
What do I have to replace for @CustomizableS2Validator

Best wondering greetings from cologne
Dirk

--
softwareentwickler

denkwerk gmbh | vogelsanger straße 66 | d-50823 köln
telefon +49 221 2942 100 | telefax +49 221 2942 101
GF: Axel Schmiegelow, Marco Zingler, Jochen Schlaier, Frank Zimpel
HRB 32063 Amtsgericht Köln  -  www.denkwerk.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to