File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes HttpSession vs PageContext Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "HttpSession vs PageContext " Watch "HttpSession vs PageContext " New topic
Author

HttpSession vs PageContext

Brian Nice
Ranch Hand

Joined: Nov 02, 2000
Posts: 195
If I am in a servlet and have an instance of PageContext, say pageContext, and I do:
pageContext.setAttribute(SESSION_BEAN_NAME, bean, PageContext.SESSION_SCOPE);
or I have an instance of HttpSession, say session, and store the bean in there:
session.setAttribute(SESSION_BEAN_NAME, bean);
What is the difference for this? Both ways I can still use in my JSP page <jsp:useBean id="whatever" scope="session" ... /> and have access to my bean. Or is there a difference?
Thanks!
Brian
bcnice@mindspring.com
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: HttpSession vs PageContext