You may want to first read about the difference between a session and a cookie.
Adding the following markup inside of the body tags of a JSP page will display session ID, if a session has been established.
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.