Hi Warren,

Thanks for the magic to destroy the session object when the response is
delivered to client. That's the idea. I have some attributes that I do not want
to go away as long as tomcat lives but need to have the freedom to change. some
to live only for the request.
Like say that I have a object graph like salesman list that does not change very
often. I want to keep them as context attribute. But on the
customerDetailDisplay I want to keep the customer for the one single request
only where I got request for the CustomerDetail information.
With Jserv, I used to keep them in a singleton (so called application objects)
.  Now with Tomcat 3.2.1 + Jboss 2.1, the salesman list might change once in
awhile (so that does not qualify as static type object), but it will stay the
same for long period of time.
for recap:
1. object graph that might change once in awhile, but will used by different
servlets
(hope to keep them as context session object) - how???
getContext.setAttribute("me",myGlobalObject);???

2. object graph that should  live only for the request. OK:
request.setAttribute("oh!my",myRequestObjet);
next line always will be:
getServletConfig().getServletContext().getRequestDispatcher(page).forward();

idea is to have the request hit the servlet Controller first and then go to the
view.

How do you guys handle situation like this in tomcat??

thanks

anil


Warren Crossing wrote:

> hi anil,
>
> i hope i've got your intention, you want to pass an object graph from
> servlet1 to servlet2.  tomcat provides session management through
> request.getSession().setAttribute() these objects are accessible for the
> duration of the session.  If you only want the object graph to live for the
> lifespan of a single request then use request.setAttribute() and it will
> automatically destroy() when the response is returned to the
> tomcat-request-interceptor-responder-web-server-thingy ( i think that's its'
> technical name ) ;
>
> warren.
>

Reply via email to