Does the mere act of accessing a JSP page with your browser create a session? If so, can this session then be accessed within the service method of a servlet that may be invoked later on?

John Quinn

In the page directive, one of the attributes is "session". It's default value is "true", meaning that a session will be created upon accessing the JSP page (if you do not want a JSP page to automatically participate in a session, you have to explicitly indicate the same, as <%@ page session="false" %> ).

To answer the second question, yes, you can access the session object later in servlets or other JSPs, provided of course, that the session is still active and has not been invalidated via a timeout or by calling session.invalidate().