You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Amol Ghotankar <gh...@gmail.com> on 2011/05/24 18:08:58 UTC

Issue: Action redirect do not include parameter as complex objects?

Hello,

I have tried an example in which i have inserted a user using insert method
of UserAction class.

On insert I have redirected the success to loadAdd method of UserAction.

During redirect I have passed the parameter as

<param name="user">${user}</param>

In struts 2.0.14 this gives an ognl exception.

whereas when I pass

<param name="user.id">${user.id}</param>

it works.

My observation says this is a bug in struts or ognl that it does parse
composite objects while it parses simple data types.

Any work-around please suggest.

Or

Is there any way by which I can forward the complete action context or value
stack in the redirected action


With Best Regards,

Amol Ghotankar
Technical Lead
Cursive Technologies Pvt. Ltd.
104, A1 Wing, W Sector,
Masulkar Colony, Ajmera,
Pimpri, Pune-18 INDIA
O: +91 2020 270 570
M: +91 9960 980 419
www.cursivetech.com


CURSIVE TECHNOLOGIES EMAIL NOTICE
The information contained in this email and any attachments is confidential
and may be subject to copyright or other intellectual property protection.
If you are not the intended recipient, you are not authorized to use or
disclose this information, and we request that you notify us by reply mail
or telephone and delete the original message from your mail system.

Re: Issue: Action redirect do not include parameter as complex objects?

Posted by Dave Newton <da...@gmail.com>.
On Tue, May 24, 2011 at 1:35 PM, Amol Ghotankar wrote:
> 1, Why I need to pass the object and not the id.
> --> I have just inserted it and do not want additional reads from database.

Doesn't matter (and if your caching is configured properly, shouldn't
do a round-trip anyway).

Look at a browser request--the only thing you can send is strings. Period.

> 4. Important. Can't we have a work around to forward the value stack to the
> redirected action without using action chaining, but having somewhat similar
> effect.

It's called "session scope". You can keep things in it.

Dave

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


Re: Issue: Action redirect do not include parameter as complex objects?

Posted by Amol Ghotankar <gh...@gmail.com>.
Ok.

1, Why I need to pass the object and not the id.
--> I have just inserted it and do not want additional reads from database.

2. Can't image url & get request.
--> Exactly. Why do we have just GET here, can't we have post also.

3. Old version.
--> Applications can't be upgraded for every version released so best stable
release of struts2 is used. i.e 2.0.14

4. Important. Can't we have a work around to forward the value stack to the
redirected action without using action chaining, but having somewhat similar
effect.
?

5. Why can't we post values through redirect action, any work around to do
that?
?

Re: Issue: Action redirect do not include parameter as complex objects?

Posted by Maurizio Cucchiara <ma...@gmail.com>.
I can't resist to imagine a connection pool that pass over a get request :)

-- 
Maurizio Cucchiara

Re: Issue: Action redirect do not include parameter as complex objects?

Posted by Dave Newton <da...@gmail.com>.
Not to mention that's not how URL parameters work--all you can send is strings.

Dave

On Tue, May 24, 2011 at 12:40 PM, Maurizio Cucchiara
<ma...@gmail.com> wrote:
> Aside from you're using an old version of S2, I don't think your approach is
> the best one. Why should you pass every parameters? You could simply pass
> just the id and then load the user object inside your loadAdd method.
>
> On 24 May 2011 18:08, Amol Ghotankar <gh...@gmail.com> wrote:
>
>> Hello,
>>
>> I have tried an example in which i have inserted a user using insert method
>> of UserAction class.
>>
>> On insert I have redirected the success to loadAdd method of UserAction.
>>
>> During redirect I have passed the parameter as
>>
>> <param name="user">${user}</param>
>>
>> In struts 2.0.14 this gives an ognl exception.
>>
>> whereas when I pass
>>
>> <param name="user.id">${user.id}</param>
>>
>> it works.
>>
>> My observation says this is a bug in struts or ognl that it does parse
>> composite objects while it parses simple data types.
>>
>> Any work-around please suggest.
>>
>> Or
>>
>> Is there any way by which I can forward the complete action context or
>> value
>> stack in the redirected action
>>
>>
>> With Best Regards,
>>
>> Amol Ghotankar
>> Technical Lead
>> Cursive Technologies Pvt. Ltd.
>> 104, A1 Wing, W Sector,
>> Masulkar Colony, Ajmera,
>> Pimpri, Pune-18 INDIA
>> O: +91 2020 270 570
>> M: +91 9960 980 419
>> www.cursivetech.com
>>
>>
>> CURSIVE TECHNOLOGIES EMAIL NOTICE
>> The information contained in this email and any attachments is confidential
>> and may be subject to copyright or other intellectual property protection.
>> If you are not the intended recipient, you are not authorized to use or
>> disclose this information, and we request that you notify us by reply mail
>> or telephone and delete the original message from your mail system.
>>
>
>
>
> --
> Maurizio Cucchiara
>

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


Re: Issue: Action redirect do not include parameter as complex objects?

Posted by Maurizio Cucchiara <ma...@gmail.com>.
Aside from you're using an old version of S2, I don't think your approach is
the best one. Why should you pass every parameters? You could simply pass
just the id and then load the user object inside your loadAdd method.

On 24 May 2011 18:08, Amol Ghotankar <gh...@gmail.com> wrote:

> Hello,
>
> I have tried an example in which i have inserted a user using insert method
> of UserAction class.
>
> On insert I have redirected the success to loadAdd method of UserAction.
>
> During redirect I have passed the parameter as
>
> <param name="user">${user}</param>
>
> In struts 2.0.14 this gives an ognl exception.
>
> whereas when I pass
>
> <param name="user.id">${user.id}</param>
>
> it works.
>
> My observation says this is a bug in struts or ognl that it does parse
> composite objects while it parses simple data types.
>
> Any work-around please suggest.
>
> Or
>
> Is there any way by which I can forward the complete action context or
> value
> stack in the redirected action
>
>
> With Best Regards,
>
> Amol Ghotankar
> Technical Lead
> Cursive Technologies Pvt. Ltd.
> 104, A1 Wing, W Sector,
> Masulkar Colony, Ajmera,
> Pimpri, Pune-18 INDIA
> O: +91 2020 270 570
> M: +91 9960 980 419
> www.cursivetech.com
>
>
> CURSIVE TECHNOLOGIES EMAIL NOTICE
> The information contained in this email and any attachments is confidential
> and may be subject to copyright or other intellectual property protection.
> If you are not the intended recipient, you are not authorized to use or
> disclose this information, and we request that you notify us by reply mail
> or telephone and delete the original message from your mail system.
>



-- 
Maurizio Cucchiara

RE: Issue: Action redirect do not include parameter as complex objects?

Posted by Jason Pyeron <jp...@pdinc.us>.
> -----Original Message-----
> From: Amol Ghotankar [mailto:ghotankarua50@gmail.com] 
> Sent: Tuesday, May 24, 2011 12:09
> To: Struts Users Mailing List
> Subject: Issue: Action redirect do not include parameter as 
> complex objects?
> 
> Hello,
> 
> I have tried an example in which i have inserted a user using 
> insert method of UserAction class.
> 
> On insert I have redirected the success to loadAdd method of 
> UserAction.
> 
> During redirect I have passed the parameter as
> 
> <param name="user">${user}</param>
> 
> In struts 2.0.14 this gives an ognl exception.
> 
> whereas when I pass
> 
> <param name="user.id">${user.id}</param>
> 
> it works.
> 
> My observation says this is a bug in struts or ognl that it 
> does parse composite objects while it parses simple data types.
> 
> Any work-around please suggest.

Don't do it that way. The design is flawed.

> 
> Or
> 
> Is there any way by which I can forward the complete action 
> context or value stack in the redirected action
> 

Disclaimer: there are reasons why this is not common.
That being said: Use the session or application scope to store the object and
pass a token/key to the item stored in the url.
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-                                                               -
- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
-                                                               -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.

 


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