On 9/5/06, Johan Compagner <[EMAIL PROTECTED]> wrote:

hmm i am not to happy with yet another getValueXXX method on FormComponent. We should clean that up!
So i would map to an existing method (i guess getConvertedValue())

thats fine - i just thought IValidationContext.getConvertedValue() sounds a bit funny

But you want to sent the FormComponent instances to the service layer? Is the service layer always on the same machine?
(if that is seperated like 1 or more Web servers that handle http load and one service server that does the db handling and so on) you have a problem
when sending over the formcomponent (that will take everything with it)

no, because validation still happens in wicket layer. i am talking about writing separate validator objects that wicket and the service layer can reuse.

And shoudnt the validation context have more info? What property are you validating? Where do i get getValue() on?
But can't this be wrapped in a ServiceLayourValidator that makes or is that IValidationContext? And calls the service layer?

you only need all this extra info to build an error message later. but if the validationcontext has a way for you to build an error message now then i dont think you need to know all that extra stuff, you just need to know the value you are validating.
 
you can wrap the other way around, but then you always have to do
formcomponent.add(new MyValidatorAdapter(new MyServiceLayerValidator()))
it gets very tedious, if they implemented the same interfaces there would be no need.

as im said i dont know about the design yet, hoping you guys can help me flush it out.

-Igor


johan


On 9/5/06, Igor Vaynberg < [EMAIL PROTECTED]> wrote:
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




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



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