Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

session attribute in page directive

 
swapnel surade
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

<%@page session="true" %>

I'm not getting the meaning of session attribute.
Please explain this.

 
Chinmaya Chowdary
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Swapnel. The page that declares <%@page session="true" %>, tells the container that this page participates in session. So the container creates session implicit object. If it is declared with "false", the container will not provide session implicit object. So, is not able to participate in the session.
 
swapnel surade
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what if I create session object in the scriptlet.
Will it create new session or return the same one ?
 
Chinmaya Chowdary
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Swapnel. If we say<%@ page session="false" %>, then the session will not available to the page, even if you call pageContext.getSession() in scriptlet.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic