Hi Perdo, Using the session approach u get and set for a particular user, across all the servlets. With ServletContext approach, u get and set values across all the users, all the session and all the servlets. Did I make things clear. M -----Original Message----- From: A mailing list for discussion about Sun Microsystem's Java Servlet API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Pedro Salazar Sent: Saturday, June 23, 2001 1:02 AM To: [EMAIL PROTECTED] Subject: get/setAttribute() by using ServletContext or HttpSession? Greetings, I was wondering what is the difference between these two ways of handling attributes: 1)[req is the HttpServletRequest parameter of the service() method in HttpServlet] ... HttpSession session=req.getSession(true); MyObject myObject=(MyObject)session.getAttribute("xxx"); ... or 2) [using the getContext() of HttpServlet object] ... MyObject myObject=(MyObject)getContext().getAttribute("xxx"); ... If they do the same thing, what is the preferable / recommendable way? thanks, Pedro Salazar ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
