You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jerald Dominic <je...@gmail.com> on 2022/07/20 02:22:53 UTC

Struts 6.0.0 - Issue getting param value from struts.xml to Action

Hello,

We are migrating from Struts 2.5.26 to 6.0.0
*Issue*
Result type used in struts.xml is the default one and below is an example
of what we have, and we use request attributes as well.
<result name="success">actionB?para1=value1&amp;para2=value2</result>
When migrating to Struts 6.0.0 the above result type is not working anymore.
If we use chain the parameters set in struts.xml file are not available in
ActionB class but the request attributes set in the calling action are
available, when we use redirectAction we get the parameters set in
struts.xml but the request attributes that are set in ActionA are not
available in ActionB.

<action name="actionA" class="org.apache.struts_examples.ActionA">
            <result name="success" type="redirectAction">
                <param name="actionName">actionB</param>
                <param name="para1">value1</param>
            </result>
</action>
<action name="actionB" class="org.apache.struts_examples.ActionB">
         <result>WEB-INF/ActionB.jsp</result>
</action>

In actionB when we try to get the parameter set in struts xml we get null.
System.out.println("para1:" + request.getParameter("para1"));
Note that this was working fine in Struts 2.5.26.

Mapping the results to jsp instead of actions chaining or action
redirection, or removing the parameters from struts xml and finding an
alternate solution will be a time consuming task since it is used
extensively.

Any suggestions in resolving this will help us.

Thank you
Jerald

Re: Struts 6.0.0 - Issue getting param value from struts.xml to Action

Posted by Lukasz Lenart <lu...@apache.org>.
śr., 20 lip 2022 o 21:32 Jerald Dominic <je...@gmail.com> napisał(a):
>
> Hello Lukasz,
>
> Thank you.
> It works fine with the 2.5.30 version.
> In order to plan for future migration of our application to Struts 6, what
> should be the next step?
> Should I go ahead and report it as a bug? Appreciate any suggestion you can
> provide on this.

Could you test 6.1.0-SNAPSHOT? I suspect it has something to do with
https://issues.apache.org/jira/browse/WW-5190 or a new security
changes, do you see any WARN like this

Expression [so-and-so] isn't allowed by pattern [so-and-so]! See
Accepted / Excluded patterns at
https://struts.apache.org/security/

?


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


Re: Struts 6.0.0 - Issue getting param value from struts.xml to Action

Posted by Jerald Dominic <je...@gmail.com>.
Hello Lukasz,

Thank you.
It works fine with the 2.5.30 version.
In order to plan for future migration of our application to Struts 6, what
should be the next step?
Should I go ahead and report it as a bug? Appreciate any suggestion you can
provide on this.

Thanks
Jerald




On Wed, Jul 20, 2022 at 1:36 AM Lukasz Lenart <lu...@apache.org>
wrote:

> Hi Jerald,
>
> Could you try to migrate to the 2.5.30 version first just to confirm
> it's not something from the 2.5.x branch?
>
>
> Thanks in advance
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> śr., 20 lip 2022 o 04:21 Jerald Dominic <je...@gmail.com> napisał(a):
> >
> > Hello,
> >
> > We are migrating from Struts 2.5.26 to 6.0.0
> > *Issue*
> > Result type used in struts.xml is the default one and below is an example
> > of what we have, and we use request attributes as well.
> > <result name="success">actionB?para1=value1&amp;para2=value2</result>
> > When migrating to Struts 6.0.0 the above result type is not working
> anymore.
> > If we use chain the parameters set in struts.xml file are not available
> in
> > ActionB class but the request attributes set in the calling action are
> > available, when we use redirectAction we get the parameters set in
> > struts.xml but the request attributes that are set in ActionA are not
> > available in ActionB.
> >
> > <action name="actionA" class="org.apache.struts_examples.ActionA">
> >             <result name="success" type="redirectAction">
> >                 <param name="actionName">actionB</param>
> >                 <param name="para1">value1</param>
> >             </result>
> > </action>
> > <action name="actionB" class="org.apache.struts_examples.ActionB">
> >          <result>WEB-INF/ActionB.jsp</result>
> > </action>
> >
> > In actionB when we try to get the parameter set in struts xml we get
> null.
> > System.out.println("para1:" + request.getParameter("para1"));
> > Note that this was working fine in Struts 2.5.26.
> >
> > Mapping the results to jsp instead of actions chaining or action
> > redirection, or removing the parameters from struts xml and finding an
> > alternate solution will be a time consuming task since it is used
> > extensively.
> >
> > Any suggestions in resolving this will help us.
> >
> > Thank you
> > Jerald
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Struts 6.0.0 - Issue getting param value from struts.xml to Action

Posted by Lukasz Lenart <lu...@apache.org>.
Hi Jerald,

Could you try to migrate to the 2.5.30 version first just to confirm
it's not something from the 2.5.x branch?


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

śr., 20 lip 2022 o 04:21 Jerald Dominic <je...@gmail.com> napisał(a):
>
> Hello,
>
> We are migrating from Struts 2.5.26 to 6.0.0
> *Issue*
> Result type used in struts.xml is the default one and below is an example
> of what we have, and we use request attributes as well.
> <result name="success">actionB?para1=value1&amp;para2=value2</result>
> When migrating to Struts 6.0.0 the above result type is not working anymore.
> If we use chain the parameters set in struts.xml file are not available in
> ActionB class but the request attributes set in the calling action are
> available, when we use redirectAction we get the parameters set in
> struts.xml but the request attributes that are set in ActionA are not
> available in ActionB.
>
> <action name="actionA" class="org.apache.struts_examples.ActionA">
>             <result name="success" type="redirectAction">
>                 <param name="actionName">actionB</param>
>                 <param name="para1">value1</param>
>             </result>
> </action>
> <action name="actionB" class="org.apache.struts_examples.ActionB">
>          <result>WEB-INF/ActionB.jsp</result>
> </action>
>
> In actionB when we try to get the parameter set in struts xml we get null.
> System.out.println("para1:" + request.getParameter("para1"));
> Note that this was working fine in Struts 2.5.26.
>
> Mapping the results to jsp instead of actions chaining or action
> redirection, or removing the parameters from struts xml and finding an
> alternate solution will be a time consuming task since it is used
> extensively.
>
> Any suggestions in resolving this will help us.
>
> Thank you
> Jerald

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