WorkFlow Interceptor does the validation by invoking the validate() method defined in the action class. Why do we have a seperate interceptor like "Validation" Interceptor. Can some body tell
1. The difference between these two interceptor
2. What sort of validation should be done with Validation/Workflow Interceptor
In our project we are using both, but not sure why.
Naresh Shanmugam wrote:WorkFlow Interceptor does the validation by invoking the validate() method defined in the action class.
That's not actually true. Validation does the validation. Workflow uses the results of validation (if any) to determine if we need to see the "input" result (by default) again. The information on the S2 wiki is incorrect (and actually contradictory) but nobody's updated it. See the source at the end of this message for further info.
In other words, using just the "validation" interceptor isn't enough, unless you're handling any errors on your own (which you could certainly do).
Note that the source for the interceptors is available, and provides a trivial answer to questions like this.
The DefaultWorkflowInterceptor is this (*heavily* edited for clarity):
Joined: Jul 16, 2010
David, Please tell me if my understanding is correct.
1. Validation Interceptor does the actual validation of calling the validate() method of the action. It also adds error if there are any during validation.
2. WorkFlow Interceptor which checks for these errors, and changes the flow based on it.