Title: RE: difference between request.setParameter and session.putValue????? - but they achieve the same effect--dont they?
No,
 
sessions are longer lived than requests. 'Requests' last for the lifetime of this HTTP request, Sessions last for the lifetime of this users 'session' which may encapsulate a number of requests, and could in fact be state persisted at the client,
 
Kevin
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Rupesh Choubey
Sent: 09 October 1999 01:33
To: [EMAIL PROTECTED]
Subject: Re: difference between request.setParameter and session.putValue? ???? - but they achieve the same effect--dont they?

i agree.....but are they not both ways to send information to JSP from servlets? .....and in both cases, the information exists only for that request......for the next request, the information wont be around......(i am assuming the scope for the session is "request").....

do you (or anyone else) know what would happen if we put information in request and do a sendRedirect instead of a .forward? sendRedirect would cause the browser to make a new request which would mean the information is lost and cannot be obtained from the JSP.....does this make sense?

thank you for your response....
rupesh.

-----Original Message-----
From: Mike Engelhart [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 08, 1999 5:06 PM
To: [EMAIL PROTECTED]
Subject: Re: difference between request.setParameter and
session.putValue?????


It think you're comparing apples and oranges.  Sessions and requests are not
the same thing.  They are different objects with different functionality.
There is no way for you to write, in a servlet for example

request.setParameter("name", value);

and then in a JSP write this

session.getValue("name");

That will not work.   You can use session objects to pass data to a page but
you must specifically remove/invalidate it or else it will stay around for
the lifetime of the session.
Mike
----------
>From: Rupesh Choubey <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: difference between request.setParameter and session.putValue?????
>Date: Fri, Oct 8, 1999, 3:55 PM
>

>
> hi,
>
> i know you can make a value persist for the request lifetime using two ways:
>
> 1. request.setParameter("name", value);
>
> 2. session.putValue("name", value);
> and in the jsp say: <jsp: useBean name=......scope = "request"....>
>
> what is the difference between the two approaches if the object is going to
> be around only for the lifetime of the request?? am i missing something?
>
> thanks for your help,
> rupesh.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to