You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mohit Gupta <mo...@gmail.com> on 2013/03/07 12:46:52 UTC
How to make struts 2 to pass the correct parameter value even if it
has ampersand in between?
i have struts 2 action which has following method
public String viewCustomer() {
return "ViewCustomer";
}
Here is the result annotation which redirect to another legacy action
customer/view-Customer!viewCustomer.action?uid=10599&firstName=scott&lastName=Miles
@Result(name = "ViewCustomer", location =
"/Customer.do?customerId=1¶ToRetain=%{#parameters.paraToRetain}"
, type = "redirect"),
The issue is with parameter paraToRetain. paraToRetain value is
CustomerAddress.do?fisrtName=scott&lastName=Miles
But in action CustomerAddressAction i get the value of paraToRetain as
CustomerAddress.do?fisrtName=scott
not complete value i.e CustomerAddress.do?fisrtName=scott&lastName=Miles.
So basically it does not pass the
parameter correct value if it has ampersand somewhere in the value. How
can i make struts 2 to pass the correct
parameter value even if it has ampersand in between?
Re: How to make struts 2 to pass the correct parameter value even if
it has ampersand in between?
Posted by Mohit Gupta <mo...@gmail.com>.
Thanks Lukasz.
On Thu, Mar 7, 2013 at 5:34 PM, Lukasz Lenart <lu...@apache.org>wrote:
> Try to encode it or manually replace & => %26
>
> http://www.w3schools.com/tags/ref_urlencode.asp
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> 2013/3/7 Mohit Gupta <mo...@gmail.com>:
> > i have struts 2 action which has following method
> >
> > public String viewCustomer() {
> > return "ViewCustomer";
> > }
> >
> > Here is the result annotation which redirect to another legacy action
> >
> >
> customer/view-Customer!viewCustomer.action?uid=10599&firstName=scott&lastName=Miles
> > @Result(name = "ViewCustomer", location =
> > "/Customer.do?customerId=1¶ToRetain=%{#parameters.paraToRetain}"
> > , type = "redirect"),
> >
> > The issue is with parameter paraToRetain. paraToRetain value is
> > CustomerAddress.do?fisrtName=scott&lastName=Miles
> >
> > But in action CustomerAddressAction i get the value of paraToRetain as
> > CustomerAddress.do?fisrtName=scott
> > not complete value i.e CustomerAddress.do?fisrtName=scott&lastName=Miles.
> > So basically it does not pass the
> > parameter correct value if it has ampersand somewhere in the value. How
> > can i make struts 2 to pass the correct
> > parameter value even if it has ampersand in between?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: How to make struts 2 to pass the correct parameter value even if
it has ampersand in between?
Posted by Lukasz Lenart <lu...@apache.org>.
Try to encode it or manually replace & => %26
http://www.w3schools.com/tags/ref_urlencode.asp
Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
2013/3/7 Mohit Gupta <mo...@gmail.com>:
> i have struts 2 action which has following method
>
> public String viewCustomer() {
> return "ViewCustomer";
> }
>
> Here is the result annotation which redirect to another legacy action
>
> customer/view-Customer!viewCustomer.action?uid=10599&firstName=scott&lastName=Miles
> @Result(name = "ViewCustomer", location =
> "/Customer.do?customerId=1¶ToRetain=%{#parameters.paraToRetain}"
> , type = "redirect"),
>
> The issue is with parameter paraToRetain. paraToRetain value is
> CustomerAddress.do?fisrtName=scott&lastName=Miles
>
> But in action CustomerAddressAction i get the value of paraToRetain as
> CustomerAddress.do?fisrtName=scott
> not complete value i.e CustomerAddress.do?fisrtName=scott&lastName=Miles.
> So basically it does not pass the
> parameter correct value if it has ampersand somewhere in the value. How
> can i make struts 2 to pass the correct
> parameter value even if it has ampersand in between?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org