On Fri, Jun 6, 2008 at 1:22 PM, Sergey Podatelev
<[EMAIL PROTECTED]> wrote:
> Well yeah, actually, I'm using Wicket-Spring, so onValidate() takes just
> about two lines:
>
> protected void onValidate(validatable) {
>  if (((MyApplication)
> Application.get()).getUserDao().verifyPassword(userId, password) == false) {
>    error(validatable);
>  }
> }

I think it really doesn't matter much whether you put it in a
validator or directly in onSubmit. If it is something you reuse, put
it in a validator to avoid code validation. Otherwise, do whatever is
best readable. Another consideration is that if you have multiple
validations, it can get ugly to have to put in multiple if/ then
blocks (if validation x fails the set error, else save y kind of
stuff), and validators are a bit nicer in that way because they are
like pluggable checks that block form processing if any of them fails.

Eelco

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to