RE: Issue: Action redirect do not include parameter as complex objects?
> -Original Message- > From: Amol Ghotankar [mailto:ghotankaru...@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 > > ${user} > > In struts 2.0.14 this gives an ognl exception. > > whereas when I pass > > ${user.id} > > 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 x333Baltimore, Maryland 21218 - - - -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- This message is copyright PD Inc, subject to license 20080407P00. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Issue: Action redirect do not include parameter as complex objects?
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-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Issue: Action redirect do not include parameter as complex objects?
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?
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?
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 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 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 >> >> ${user} >> >> In struts 2.0.14 this gives an ognl exception. >> >> whereas when I pass >> >> ${user.id} >> >> 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-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Issue: Action redirect do not include parameter as complex objects?
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 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 > > ${user} > > In struts 2.0.14 this gives an ognl exception. > > whereas when I pass > > ${user.id} > > 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