How to create and use sessions in Eclipse

Home > Search > How-to
  by

You may want to first read about the difference between a session and a cookie.

This assumes you have created your first dynamic web project in Eclipse. There are a few different ways to create a session. You can use cookies, URL rewriting, or SSL. 

Adding the following markup inside of the body tags of a JSP page will display session ID, if a session has been established.

${pageContext.session.id}

 

In this example, the session ID was obtained. This is pratical if you want a global session for your entire site. If you need to create and destroy sessions as users request certain parts of your application, it makes more sense to create a unique session in your Java code.

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments