i am working on an app that uses wicket and remoting, so i need to do validation in wicket and in the business layer. the problem is that our validators do not translate well into the business layer, and i hate to write them twice. i can do all the validation in the service layer, but then it is not trivial to map the errors back to the form components if you need formcomponent precise errors for the ui.

to ease the pain i was thinking of something like this

IValidationContext { Object getValue(); void error(List,Map); }

and FormComponent implements IValidationContext
where getValue would map onto getConvertedInput() and error would map directly (obviously we already have getvalue() so it would have to be called something else)

it still lacks but at least i would be able to reuse the same validators in a non-wicket context. it also would be great to provide a seperate wicket-validation.jar or some such.

what do you guys think? i havent thought this through in any amount of detail, so perhaps there are better ways to do this.

error(List,Map) is a bit dirty as well, maybe it can be cleaned up somehow.

it will also make validators easier to understand because when you see validate(FormComponent) your first thought is "what the hell do i do now?" where some sort of IValidationContext would be more expressive and guide the user better.

-Igor
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-develop mailing list
Wicket-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to