This is essentially what we're doing as well, but it is far from an ideal situation. The issue I've seen is that you can't easily use the validators from the xml in the validate() method. Another disadvantage is that validation is in 2 different places. Also, some of our validate() methods get pretty verbose--about 400 lines in one instance I looked at. We'd also like to use the same validation code in the UI and in our business components. Additionally, sometimes we need to call into the process layer to perform certain validation. It also is hard to reuse validation using this technique.
All these issues indicate that an alternative to the current validation is needed. This is especially true for bigger apps that have multiple layers and very complex validation at multiple levels. Don and I were discussing this yesterday on #struts and here are some of the options we came up with: * integrate Spring's valang into struts 2 * replace the current xml with validation via ruby * replace the current xml with validation via Java, in a class separate from the action The last option has the most promise. Something along the lines of: FooAction and FooActionValidator which is automatically executed via an interceptor like the validate() method is now. FooActionValidator would have helper methods to make the validation logic very concise. I'd also like an interface like ValidationAware to capture the validation errors from lower levels of the application. (e.g. the process and dao layers) So, anyone think I'm totally off base? I'm not ready to implement anything yet, however, I think this might solve some of the issues that we've been having with our validation. Tom Igor Vlasov wrote: > > I use validate() method from ActionSupport for complex bussines > validation.(it works in WorkFlowInterceptor). > > Sometime, for trivial fields, i can use Struts ValidationFramework.(it > works after ParameterInterceptor) > > -- View this message in context: http://www.nabble.com/Validation-Best-Practices--tf4685400.html#a13453669 Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]