File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Servlets
Bookmark "HttpSession vs PageContext " Watch "HttpSession vs PageContext " New topic

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?
I agree. Here's the link:
subject: HttpSession vs PageContext
It's not a secret anymore!