On 8/30/07, j alex <[EMAIL PROTECTED]> wrote:
> Regarding field validations, can you provide any reason why the validwhen
> validator is not provided in Struts 2? . I think this is a step backwards
> from Struts 1 where we could easily manage conditional validation (validate
> fieldb only if fielda & fieldc meet some condition)

It's important to remember that Struts 2 is not a direct port of
Struts 1. The codebases developed in parallel over a number of years.
I expect it's simply that no one has written a validwhen validator for
XWork yet. The Commons Validator didn't have one for a long time too.


> Also, the validators in Struts 1 returned true/false for success/failure,
> and we had the option of adding messages or not ; but in Struts 2 the only
> way to tell a validation failed is by the presence of errors on the field.
>
> Both of these limitations (if you will) make conditional validation (without
> error message for the condition itself) almost impossible.
>
> Hope i'm not missing anything here. Please let us know your thoughts

I never used the Common Validator that way myself. People often make
complex validations in the Action method and then let the framework
handle the simple cases.

Of course, there's much to be desired in either validation framework,
which is why Jason has been trying to get a JSR going.

 * http://jcp.org/en/jsr/detail?id=303

Though, I'm not sure if much headway is being made.

Personally, I'd like to see a fresh approach to validation that also
included type conversion and text formatting as part of the workflow,
and that did not throw away internally-created objects, just so that
we can convert them a second time. I'd also like to see an API that we
could implement in JavaScript, as well as Java and C#.  (Or maybe a
JavaScript API that we could use via Rhino or JScript.)

Now see what happens when you ask for my thoughts!

-Ted.

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

Reply via email to