Reputation: 97
I wrote an interceptor for struts2 application and configured in struts configuration file. Here i am using this interceptor for only some actions , not for globally.So here my problem is when validation errors are coming from ActionName-validation.xml at that time my custom interceptor is not working.Please give me suggestion/solution.
Upvotes: 1
Views: 84
Reputation: 50203
First of all, read how the validation (and conversion) error are handled by Struts2, then move your Interceptor BEFORE the Validation/Parameters/ConversionError Interceptors
The easier way is to define a new stack with your interceptor at first (or in the middle, "exploding" the defaultStack) like follows:
<interceptor-stack name="customStack">
<interceptor-ref name="customInterceptor"/>
<interceptor-ref name="defaultStack"/>
</interceptor-stack>
And then apply customStack
or defaultStack
action by action or package by package, according to your needs.
Upvotes: 1