I have an interceptor that is working fine except the query string is not being passed on to the action from the interceptor.
<action name="EditIroCase" class="iro.action.IroCaseAction">
<interceptor-ref name="authIro"/>
<result name="success">iro/IroCaseFORM.jsp</result>
</action>
URL: /EditIroCase.action?id=123
Action is an existing one that I am adding the interceptor to. Implementing ParametersAware
in Action
to get ID from URL and that works fine.
Tried a couple different things, but can't seem to make it work. Used lots of interceptors, just never needed to maintain a param across its execution.
Interceptors work slightly different rather than actions. Because they belong to the action. So you can't add an action to the interceptor, but interceptor to the action.
You should know if you are using xml configuration or annotations, or another configuration provider, interceptors are stored in the collection such as List
or Set
, doesn't matter, but all of them in one place. Using <interceptor-ref>
tag inside the <action>
overrides the interceptor's config. By default actions are configured using <default-interceptor-ref>
tag, which is defined in the struts-default.xml
from the core package, and it points to defaultStack
. This stack is designed to serve all your needs, but if you use a custom interceptor then you should explicitly add reference to defaultStack
or create a custom stack which you would reference.
<action name="EditIroCase" class="iro.action.IroCaseAction">
<interceptor-ref name="authIro"/>
<interceptor-ref name="defaultStack"/>
<result name="success">iro/IroCaseFORM.jsp</result>
</action>
Now parameters should be populated.