This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
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
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
 
GeeCON Prague 2014
 
subject: HttpSession vs PageContext