It's annoying because it uses a side effect to figure out if validation failed. Instead of setting some flag when any validation fails and using that flag to determine if the INPUT result should be displayed, it is using the number of error messages to determine if there were any validation errors.

It violates the principle of least surprise because the action method got called and it returned a result. This is the result the programmer expects to be rendered. Especially if there were no validation errors, only error messages added by the application code.

        - Aner

On 04/14/2011 12:00 PM, Dave Newton wrote:
On Thu, Apr 14, 2011 at 11:54 AM, Aner Perez<a...@ncstech.com>  wrote:
This is an annoying "feature" of the Workflow interceptor.  If 
ValidationAware.hasErrors() returns
true, the interceptor chain is stopped and Action.INPUT is returned.  If you 
put error messages
on your action, it will make hasErrors return true which will force the "input" 
result to be returned.

How is it annoying? That's the interceptor's purpose in life, to
handle workflow. Errors usually change flow. "Mucking" with the
interceptor is as simple as changing the inputResultName property for
the specific action, although in this case I don't really see why it'd
be worth it.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to