I am developing a website using Struts 2. Now, I am writing an Interceptor by extending AbstractInterceptor.
I want to access fieldErrors in the interceptor, but I don’t know how to do it.
In an action which extends ActionSupport, I can add a field error just like this:
addFieldError(fieldName, errorMsg);
How to do the same thing in a customized interceptor?
The same way, by accessing the action’s fieldErrors property, after casting the action to either ActionSupport, or the specific interface if you’re not using ActionSupport.