You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by JOSE L MARTINEZ-AVIAL <jl...@gmail.com> on 2010/01/13 02:32:37 UTC

Distinguish between request parameters and struts.xml parameters in Struts2

 Distinguish between request parameters and struts.xml parameters in Struts2

Hi all,
  I'm trying to distinguish the parameters that come from the request from
those that come from the params defined in the struts.xml. For example, I
have the following mapping in my struts.xml

        <action name="Login_*" method="{1}" class="example.Login">
            <param name="resource">my resource</param>
            <result name="input">/example/Login.jsp</result>
            <result type="redirectAction">Menu</result>
        </action>

The call to that action will have a variable number of parameters, so I want
to distinguish between them and the parameter defined in the struts.xml. How
can I do that? In Struts 1 I was able to use the tag <set-property>, and
since the action was separated from the form, there was no problem, but in
Struts2 that is no longer possible. Any ideas?

Thanks

Jose Luis

Re: Distinguish between request parameters and struts.xml parameters in Struts2

Posted by Gabriel Belingueres <be...@gmail.com>.
Implement interface ParameterAware: if the "resource" key is not in
the parameter map, then the variable was set by other means than input
parameters.

2010/1/12 JOSE L MARTINEZ-AVIAL <jl...@gmail.com>:
>  Distinguish between request parameters and struts.xml parameters in Struts2
>
> Hi all,
>  I'm trying to distinguish the parameters that come from the request from
> those that come from the params defined in the struts.xml. For example, I
> have the following mapping in my struts.xml
>
>        <action name="Login_*" method="{1}" class="example.Login">
>            <param name="resource">my resource</param>
>            <result name="input">/example/Login.jsp</result>
>            <result type="redirectAction">Menu</result>
>        </action>
>
> The call to that action will have a variable number of parameters, so I want
> to distinguish between them and the parameter defined in the struts.xml. How
> can I do that? In Struts 1 I was able to use the tag <set-property>, and
> since the action was separated from the form, there was no problem, but in
> Struts2 that is no longer possible. Any ideas?
>
> Thanks
>
> Jose Luis
>

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