struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <>
Subject Re: Efficient session object and cookie checks in struts
Date Sat, 15 Apr 2006 09:41:07 GMT
Jeff Thorne on 15/04/06 06:19, wrote:
> My struts application maintains 2 small objects in the user’s
> session. One is for the users location info (mandatory) and the other
> is the User Object (optional). I also save 2 cookies one being the
> user’s location info (mandatory) and the other the user’s saved login
> credentials (optional) to maintain the user’s information between
> sessions.
> When a user returns to my site I need to check for the location and
> User objects in the session. If they are not there I look for the
> cookies to get the information needed to recreate these session
> objects. I need to perform these checks on 90% of my actions and jsp
> pages however I find these checks slowing down my application. What
> would be the most efficient way to provide these checks? Would it be
> to provide the checks in the action base class?

Hi Jeff,

if you don't mind me asking, how do you know it is slowing your app
down? To perform these checks should require only an if clause such as

if (session.getAttribute("bean") == null)

If you have that in one place, it shouldn't slow anything down.

In answer to your question though, I would do this in an action base 
class and keep the code in one place. If you are using JSPs where you 
need the info but you don't go through an action to get there, you could 
put it in a filter - or perhaps more simply, make all your paths go 
through actions.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message