You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Markus Demetz <ma...@webeffects.it> on 2007/11/07 14:49:53 UTC

Keep Objects over request

Hi all!

I'm looking for a convenience way to keep an Object over a single 
request. I know that i could put it into the session and remove it 
afterwards, but is there another way to handle this, without needing to 
remove it explicitely?

For those who know Symfony (php framework) there is a setFlash(..) 
method which keeps objects alive over a request and deletes them afterwards.
Is there something similar in Struts (ver.1) or some approach?

Thank you, Markus



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


Re: Keep Objects over request

Posted by Giovanni Azua <gi...@imc.nl>.
Opps sorry :) besides these are rather hacks than a clean way to go .. 
apologies :)

regards,
Giovanni

Antonio Petrelli wrote:
> 2007/11/7, Giovanni Azua <gi...@imc.nl>:
>   
>> If it is a lightweight object then you could serialize it and encode it
>> into the URL i.e. GET you can then use the attribute
>> <includeParams="get"> and S2 will keep reposting the same serialized
>> value parameter over and over as part of the request.
>>     
>
>
> Ahem Giovanni, we are talking about S1 :-)
>
> Antonio
>
>   

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


Re: Keep Objects over request

Posted by Antonio Petrelli <an...@gmail.com>.
2007/11/7, Giovanni Azua <gi...@imc.nl>:
>
> If it is a lightweight object then you could serialize it and encode it
> into the URL i.e. GET you can then use the attribute
> <includeParams="get"> and S2 will keep reposting the same serialized
> value parameter over and over as part of the request.


Ahem Giovanni, we are talking about S1 :-)

Antonio

Re: Keep Objects over request

Posted by Giovanni Azua <gi...@imc.nl>.
hi,

Just couple of ideas :)

If it is a lightweight object then you could serialize it and encode it 
into the URL i.e. GET you can then use the attribute 
<includeParams="get"> and S2 will keep reposting the same serialized 
value parameter over and over as part of the request.

Probably a cleaner solution IMHO would be using interceptors and again 
serializing the object into file system/ or Database and reloading and 
injecting it to all relevant actions when needed.

But then if it is a lightweight object what's the big deal to put it in 
the session?

HTH,
regards,
Giovanni

Markus Demetz wrote:
> Hi all!
>
> I'm looking for a convenience way to keep an Object over a single 
> request. I know that i could put it into the session and remove it 
> afterwards, but is there another way to handle this, without needing 
> to remove it explicitely?
>
> For those who know Symfony (php framework) there is a setFlash(..) 
> method which keeps objects alive over a request and deletes them 
> afterwards.
> Is there something similar in Struts (ver.1) or some approach?
>
> Thank you, Markus
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org

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


Re: Keep Objects over request

Posted by Antonio Petrelli <an...@gmail.com>.
2007/11/7, Markus Demetz <ma...@webeffects.it>:
>
> Hi all!
>
> I'm looking for a convenience way to keep an Object over a single
> request. I know that i could put it into the session and remove it
> afterwards, but is there another way to handle this, without needing to
> remove it explicitely?
>
> For those who know Symfony (php framework) there is a setFlash(..)
> method which keeps objects alive over a request and deletes them
> afterwards.
> Is there something similar in Struts (ver.1) or some approach?



There is a JIRA issue for this:
https://issues.apache.org/struts/browse/STR-2939
But there is no real implementation :-(
I know that it could be a bit of marketing, but think about the use of
Scopes:
http://scopes.sourceforge.net/
In particular, the "click" scope:
http://scopes.sourceforge.net/documentation/more-scopes/click-scope.html

Ciao
Antonio