You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by lixin chu <li...@yahoo.com> on 2004/10/15 07:20:01 UTC

mechanism to clear objects in the session

Hi,
I saw an ealier thread discussing this but still can
not fully understand the solution.

appreciate if any one can provide some more detailed
info on this. basically if the current page flow is
terminated for some reason, how the Struts application
can clear the objects stored in the session ?

thanks
li xin

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: mechanism to clear objects in the session

Posted by lixin chu <li...@yahoo.com>.
thanks. it indeed helps me, in fact the points are
critical - i need to think my use cases twice, and you
have also pointed out a couple of choices. i will try
to come out a cleaner implementation in my system.
thanks again !



--- Erik Weber <er...@mindspring.com> wrote:

> There was no common solution discussed that I
> recall. But, the idea is, 
> put a class to work in a place where it can monitor
> every request. For 
> example, in a Servlet Filter, or in a Struts
> RequestProcessor subclass, 
> or an Action base class. As far as I know, there is
> no existing 
> framework or common utility for doing this sort of
> thing. I have found 
> that using a common naming convention (or even a
> common key) for these 
> types of session attributes makes programming the
> cleanup easier. 
> Tracking page flow and deciding what's going with
> the flow and what's 
> going against the flow is up to you.
> 
> A real simple first implementation might be to clean
> out all session 
> attributes (such as forms) that are considered
> "working" attributes (not 
> those, such as "user" objects, that are needed for
> the lifetime of the 
> session) whenever the user returns to the "home"
> page (in your "home" 
> Action).
> 
> It is worth noting that good navigation design
> inherently makes this 
> sort of thing easier. Applications should have
> "home" views, and 
> sections of the application should have their own
> "home" views. When the 
> user finishes a task, he returns to the home view
> for the section he's 
> using, or to the main home view. This is where you
> can do cleanup (while 
> you are preparing the home view).
> 
> Or not. The particular design isn't really relevant.
> The point is to 
> design *something*, to think it through ahead of
> time, instead of just 
> drawing pages and making them "work".
> 
> Sorry I didn't help much.
> 
> Erik
> 
> 
> 
> lixin chu wrote:
> 
> >Hi,
> >I saw an ealier thread discussing this but still
> can
> >not fully understand the solution.
> >
> >appreciate if any one can provide some more
> detailed
> >info on this. basically if the current page flow is
> >terminated for some reason, how the Struts
> application
> >can clear the objects stored in the session ?
> >
> >thanks
> >li xin
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> >http://mail.yahoo.com 
> >
>
>---------------------------------------------------------------------
> >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
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: mechanism to clear objects in the session

Posted by Erik Weber <er...@mindspring.com>.
There was no common solution discussed that I recall. But, the idea is, 
put a class to work in a place where it can monitor every request. For 
example, in a Servlet Filter, or in a Struts RequestProcessor subclass, 
or an Action base class. As far as I know, there is no existing 
framework or common utility for doing this sort of thing. I have found 
that using a common naming convention (or even a common key) for these 
types of session attributes makes programming the cleanup easier. 
Tracking page flow and deciding what's going with the flow and what's 
going against the flow is up to you.

A real simple first implementation might be to clean out all session 
attributes (such as forms) that are considered "working" attributes (not 
those, such as "user" objects, that are needed for the lifetime of the 
session) whenever the user returns to the "home" page (in your "home" 
Action).

It is worth noting that good navigation design inherently makes this 
sort of thing easier. Applications should have "home" views, and 
sections of the application should have their own "home" views. When the 
user finishes a task, he returns to the home view for the section he's 
using, or to the main home view. This is where you can do cleanup (while 
you are preparing the home view).

Or not. The particular design isn't really relevant. The point is to 
design *something*, to think it through ahead of time, instead of just 
drawing pages and making them "work".

Sorry I didn't help much.

Erik



lixin chu wrote:

>Hi,
>I saw an ealier thread discussing this but still can
>not fully understand the solution.
>
>appreciate if any one can provide some more detailed
>info on this. basically if the current page flow is
>terminated for some reason, how the Struts application
>can clear the objects stored in the session ?
>
>thanks
>li xin
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam?  Yahoo! Mail has the best spam protection around 
>http://mail.yahoo.com 
>
>---------------------------------------------------------------------
>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