I'm not sure that web containers are required to create a new thread
at the beginning of each request.  Weblogic, for example, seems to
keep a pool of available threads, and uses one of these threads to
process each request.  Using ThreadLocal with this type of app server
would mean that whatever you saved using ThreadLocal on one request
would stick around until you explicitly removed it.

On 4/13/05, Corey Probst <[EMAIL PROTECTED]> wrote:
> I don't know of a way to access the session from your business logic
> other than passing it in as a parameter (which I would *NOT*
> recommend).  Even if you could access it, you would be tying the
> business layer to the servlet api, which is what you are trying to
> avoid by not passing the session directly.
> 
> Take a look at ThreadLocal, I've never used it but it should do what
> you want. http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ThreadLocal.html
> 
> You would set it somewhere at the beginning of the request and then it
> would be available as long as the thread stays alive.
> 
> Someone correct me if this is not a good idea or won't work
> 
> Hope it helps.
> Corey
> 
> On 4/13/05, Mallik <[EMAIL PROTECTED]> wrote:
> > I can use  getSesssion and setSession in the action class but I need to 
> > access
> > session variable in my java bean where I perform my business logic, not in
> > action class methods. (java beans are called from action class). I hope I am
> > clear this time.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to