2 Minutes To Code (β Version)

Java Servlets - 2 minute tutorial

How to get existing session for an http client

To get the HttpSession object if it already exists and return null otherwise, use the method getSession(false) of the HttpServletResponse object as shown in the example below.

protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
	HttpSession session = req.getSession(false);