s.susini
s.susini

Reputation: 601

Struts 2 Action: parameter access

I defined an action like this:

<action name="login" class="tognetti.site.actions.AuthenticationAction">
 <param name="defaultURI">/secure/listaAnnunci.action</param>
    <result>/login.jsp</result>
</action>

I can I access the param from inside the action? Thanks

Upvotes: 2

Views: 973

Answers (1)

Pat
Pat

Reputation: 25685

You need to implement the Static Parameters interceptor my good man:

<action name="login" class="tognetti.site.actions.AuthenticationAction">
   <interceptor-ref name="defaultStack"/>
   <interceptor-ref name="staticParams">
      <param name="defaultURI">/secure/listaAnnunci.action</param>
   </interceptor-ref>
   <result>/login.jsp</result>
</action>

Then have your Action implement Parameterizable and your param's will be added to the request params map.

Upvotes: 3

Related Questions