• Post Reply Bookmark Topic Watch Topic
  • New Topic

HttpSession vs PageContext  RSS feed

Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!