my dog learned polymorphism*
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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
Similar Threads
Adding more than one validation to form field
short-circuit attribute not working in validation file
error in validation
problem in field validation
Understanding public void prepare() +tiles