File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes short-circuiting validations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "short-circuiting validations" Watch "short-circuiting validations" New topic

short-circuiting validations

M Turner

Joined: Dec 16, 2009
Posts: 25
I'm not seeing the short-circuiting in my validations behaving as I would expect according to the following documentation:

A plain Validator (non FieldValidator) that gets short-circuited will completely break out of the validation stack. No other validators will be evaluated and plain validators takes precedence over field validators meaning that they get evaluated in the order they are defined before field validators get a chance to be evaluated.

My validations are defined as:

I would expect that only 1 error message would be displayed, since it's supposed to "completely break out of the validation stack", however, I see 3 error messages. Plus, my field validations are still executing.

My goal is that if any of the strings is blank, the user will get only one message and the other field validations will get short-circuited. Do I have to use an expression to accomplish this?

M Turner

Joined: Dec 16, 2009
Posts: 25
After further digging I found that "expression" is the only true non-field validator which explains the behavior I was seeing.
I agree. Here's the link:
subject: short-circuiting validations
jQuery in Action, 3rd edition