You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by anil <an...@awcoldstream.com> on 2001/05/22 21:26:20 UTC

===>Session Question<===

Hello,

I do have servlet that process request and forward to another servlet.
like.
->request-----> Servlet1------->servlet2
                          session-obj-1    session-obj1(destroy
session-obj1 request is done-user gets html back)

At the end of sevlet2, user get html window back.
I want setup a session object in servlet valid only for that request. I
mean it should not valid beyond servlet2.
if I use request.getSession(x), this session-obj1 is valid until the
browser is closed.

is there anyway to do this without calling removeAttribute() ????

thanks

anil


Re: ===>Session Question<===

Posted by "Daniel A. Melo" <da...@codata.com.br>.
put the object in the request with setParameter().

the scope for this object is the request... it will be destroyed when you
call the 2nd servlet.


[]´s

Daniel A.



anil wrote:

> Hello,
>
> I do have servlet that process request and forward to another servlet.
> like.
> ->request-----> Servlet1------->servlet2
>                           session-obj-1    session-obj1(destroy
> session-obj1 request is done-user gets html back)
>
> At the end of sevlet2, user get html window back.
> I want setup a session object in servlet valid only for that request. I
> mean it should not valid beyond servlet2.
> if I use request.getSession(x), this session-obj1 is valid until the
> browser is closed.
>
> is there anyway to do this without calling removeAttribute() ????
>
> thanks
>
> anil


Re: ===>Session Question<===

Posted by anil <an...@awcoldstream.com>.
No, I do not want to invalidate whole session. I have some varibales that I
want keep. But I want some to alive only in the request.

thanks

anil

Alin Simionoiu wrote:

> have you try to invalidate the session ?
>
> ----- Original Message -----
> From: "anil" <an...@awcoldstream.com>
> To: "tomcat" <to...@jakarta.apache.org>
> Sent: Tuesday, May 22, 2001 12:26 PM
> Subject: ===>Session Question<===
>
> > Hello,
> >
> > I do have servlet that process request and forward to another servlet.
> > like.
> > ->request-----> Servlet1------->servlet2
> >                           session-obj-1    session-obj1(destroy
> > session-obj1 request is done-user gets html back)
> >
> > At the end of sevlet2, user get html window back.
> > I want setup a session object in servlet valid only for that request. I
> > mean it should not valid beyond servlet2.
> > if I use request.getSession(x), this session-obj1 is valid until the
> > browser is closed.
> >
> > is there anyway to do this without calling removeAttribute() ????
> >
> > thanks
> >
> > anil
> >


Re: ===>Session Question<===

Posted by Alin Simionoiu <as...@musicnet.com>.
have you try to invalidate the session ?


----- Original Message ----- 
From: "anil" <an...@awcoldstream.com>
To: "tomcat" <to...@jakarta.apache.org>
Sent: Tuesday, May 22, 2001 12:26 PM
Subject: ===>Session Question<===


> Hello,
> 
> I do have servlet that process request and forward to another servlet.
> like.
> ->request-----> Servlet1------->servlet2
>                           session-obj-1    session-obj1(destroy
> session-obj1 request is done-user gets html back)
> 
> At the end of sevlet2, user get html window back.
> I want setup a session object in servlet valid only for that request. I
> mean it should not valid beyond servlet2.
> if I use request.getSession(x), this session-obj1 is valid until the
> browser is closed.
> 
> is there anyway to do this without calling removeAttribute() ????
> 
> thanks
> 
> anil
> 


RE: ===>Session Question<===

Posted by Martin van den Bemt <mv...@mvdb.com>.
If you just want the request object (the parameters) to be passed call the
servlet2 with the request object and finish what you're doing and the
request object is gong after that. Simple.
You can also create an hashtable in the session with those values from the
request object and delete the hashtable from the session when you're
finished, this way you can use a redirect to the next servlet, so people
don't have to resubmit the request on a refresh..

Have fun,
Martin van den Bemt



> -----Original Message-----
> From: anil [mailto:anil@awcoldstream.com]
> Sent: Tuesday, May 22, 2001 9:26 PM
> To: tomcat
> Subject: ===>Session Question<===
>
>
> Hello,
>
> I do have servlet that process request and forward to another servlet.
> like.
> ->request-----> Servlet1------->servlet2
>                           session-obj-1    session-obj1(destroy
> session-obj1 request is done-user gets html back)
>
> At the end of sevlet2, user get html window back.
> I want setup a session object in servlet valid only for that request. I
> mean it should not valid beyond servlet2.
> if I use request.getSession(x), this session-obj1 is valid until the
> browser is closed.
>
> is there anyway to do this without calling removeAttribute() ????
>
> thanks
>
> anil
>
>