You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Heikki Hyyrö <he...@uta.fi> on 2017/03/26 16:23:11 UTC

Passing a parameter from an interceptor to an action

Hi,

I would like to pass a parameter from an interceptor to an action, but 
am not sure what is a proper way to do it if I also want to ensure that 
a parameter with the same name cannot be injected into the action as a 
request parameter.

I have set the interceptor to add the parameter into the valuestack, but 
this approach does not seem to work if the parameter name is included 
either in the excludeParams-parameter of the params interceptor or as a 
blocked parameter of the parameter filter. Either of these last two 
seems to prevent the parameter from being accessible by the action. If 
the params interceptor and parameter filter apply to _all_ values in the 
value stack, and not only request parameters, then is there some other 
route that allows to pass a "private" parameter from an interceptor to 
an action?

-Heikki


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Passing a parameter from an interceptor to an action

Posted by Lukasz Lenart <lu...@apache.org>.
2017-03-26 18:23 GMT+02:00 Heikki Hyyrö <he...@uta.fi>:
> Hi,
>
> I would like to pass a parameter from an interceptor to an action, but am
> not sure what is a proper way to do it if I also want to ensure that a
> parameter with the same name cannot be injected into the action as a request
> parameter.
>
> I have set the interceptor to add the parameter into the valuestack, but
> this approach does not seem to work if the parameter name is included either
> in the excludeParams-parameter of the params interceptor or as a blocked
> parameter of the parameter filter. Either of these last two seems to prevent
> the parameter from being accessible by the action. If the params interceptor
> and parameter filter apply to _all_ values in the value stack, and not only
> request parameters, then is there some other route that allows to pass a
> "private" parameter from an interceptor to an action?

I would use a marking aware interface, the same as is done in Struts

https://struts.apache.org/maven/struts2-core/apidocs/org/apache/struts2/interceptor/package-summary.html


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org