How do you prevent the Creation of a Session in a JSP Page and why?

By default, a JSP page will automatically create a session for the request if one does not exist. However, sessions consume resources and if it is not necessary to maintain a session, one should not be created. For example, a marketing campaign may suggest the reader visit a web page for more information. If it is anticipated that a lot of traffic will hit that page, you may want to optimize the load on the machine by not creating useless sessions.

Showing Answers 1 - 3 of 3 Answers

Pchal

  • Aug 11th, 2005
 

Incude this in the Jsp page if you want to avoid creating a session: 
 
<%@ page session="false" %> 
 
 

  Was this answer useful?  Yes

nitin

  • Dec 16th, 2005
 

In the page attribute set session to false as by default its value is true.

You have to set the session to false because if ur moving from one application to another application the the session value of the previous application will be available in the second application so you have to set it to false.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions