On Fri, May 02, 2008 at 09:13:40AM -0700, David Chang wrote: > > >>Weird. Your experience is exactly opposite to mine. > I found Spring MVC to be hopelessly scattered: > declarations in XML, controller code in Java, view > code in templates. > > I dont have any real experience yet. It is mere my > observation and thinking. I am learning but still > evaluating. >
I just realized that you may not be clear on the role of FormValidators in Wicket. A FormValidator is only used when the validation of one field depends on the value the user entered for another field. The vast majority of validation uses only field-level validators, which are much less verbose than FormValidators: new TextField("name").setRequired(true); new TextField("ccNumber").add(new CreditCardValidator()); My current Wicket application (~35,000 LoC, ported from SpringMVC BTW, so I speak from experience!) has no more than a handful of FormValidators. > One thing I have is really the opposite to your > experience. I feel this "scatter" is not hopeless; but > it is a nice separation of concerns. In this case I think "separation of concerns" is just a nice way of saying "lack of cohesion/encapsulation". I *want* my validation to follow my component around, especially when I have a form composed from several re-usable panels. Here's a real-world example. In my app we have a component that captures credit card info (card number, expiry, etc). It's not a form, just a Panel with a bunch of form components on it. We re-use this panel in several very different forms, each of which has various additional fields. Each time this panel is re-used, I just drop it into the form like this: form.add(new CreditCardPanel(ccModel)); I don't have to add the CreditCardValidator to each one of these forms. It comes pre-wired in the CreditCardPanel. > have no objection to puting everything in WebPage, but > these different concerns should be separated in Wicket > somehow, code should look clean and good... Very few Wicket applications put "everything in WebPage". Pages are usually componentized into various Panels, which in turn can be composed from other Panels and components. Each of these panels/components can come with their own validators, as well as with other contributions to the page such as JS, CSS, etc. jk --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]