getSession
public HttpSession getSession(boolean create)
Returns the current HttpSession associated with this request or, if necessary, creates a new session for the request. Use true for create to create a new session, or false to return the current HttpSession. 
If create is false and the request has no valid HttpSession, this method returns null. To make sure the session is properly maintained, you must call this method at least once before you write any output to the response. Newly created sessions (that is, sessions for which HttpSession.isNew returns true) do not have any application-specific state.Parameters:
true - to create a new session for this request; false to return the current session
Returns:
the HttpSession associated with this request or null if create is false and the request has no valid session