Commons Validator with WebWork?
I'm in the midst of integrating WebWork into AppFuse. I started wiring validation last night. This morning, I realized that I could probably use Commons Validator to make validation a lot easier. Here's why:
- WebWork validation rules are defined per-action, rather than per-object. This makes it difficult to define the validation rules with XDoclet. I can't just put tags in the model object to generate the validation rules. This works with Struts and Spring quite nicely.
- Using a custom LabelTag, I've been able to hook into Commons Validator and mark fields as required. With WebWork's validation, it seems that this can only be accomplished by adding a required="true" attribute to my <ww:textfield>. I prefer the transparency of the custom tag.
- I've never been able to get WebWork's client-side validation working. Commons Validator has excellent client-side validation support.
- Spring has support classes for Commons Validator - leading me to believe that I can configure validation in Spring and re-use its JavascriptValidatorTag.
Now I just need to figure out 1) how to hook WebWork custom tags (or my own custom tag) into the validator to mark fields required and 2) how to write a validation interceptor that uses Commons Validator. Whaddya think? Are there advantages to using WW's validation over Commons Validator? Any tips for writing an interceptor or modifying the custom tags?
Posted by Lars Fischer on September 04, 2004 at 06:38 PM MDT #
Posted by Jason Carreira on September 06, 2004 at 08:05 PM MDT #
Posted by Mark Woon on September 08, 2004 at 01:35 AM MDT #
Posted by Bruce Snyder on September 14, 2004 at 04:06 PM MDT #