• 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: 437
  • 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: 437
  • 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.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!