> The server-side enhancement is that the validate() method is now called with the 
>request and
> the current mapping so that you have more context for making your validation 
>decisions --
> for example, you can go retrieve the user's session and get state information you've 
>stored
> there.

Oh, I thought that was there from v0.5. That'd make sense.

> Support for auto-generating client side validation JavaScript is not there, and is 
>unlikely
> to be in the final 1.0 release.

Well, perhaps I should to learn how the tags are built
so I can start doing this then. I have an itch. I had
a look at them, they don't seem too hard.

> I agree with using client-side validation where you can, to improve the UI by 
>catching
> errors earlier.  My caution is that you should plan on re-performing these checks as
> appropriate on the server side.  Don't assume that your JavaScript validation 
>actually took
> place.

Oh, not at all. But different people prefer different
things for their validation. Server side validation
should be for things like, "does the user exist?"
where as client should be, "is a user name entered?"

It's a balance and trade between the two. We need to
work out a good way of doing this. I don't want to
see struts become too bloated with functionality.

> This would worsen performance (handling exceptions is not particularly cheap) versus 
>the
> current approach.

> 
> Also, there are also many sorts of error checks that depend on more than one field 
>("field B
> is required if field A is present, otherwise it must be blank").  The HTTP and 
>servlet specs
> provide no guarantees on what order the request parameters are presented, so where 
>do you
> put the checks for this?  In many cases, you are going to need a global validate() 
>method of
> some sort anyway.

Um, yes. Good point. I didn't think of that.

I'll try and get my JavaScript validation library together,
clean it up and put it on my web site (which needs a good clean
up anyway).

And then write some stuff about how we could look at a client
side validation, that works with a server side one.


Reply via email to