HOME      BLOG       FORUMS      CONTACT       ABOUT

Find out session created time in JSP/Servlet

May 14th, 2010 Albin Joseph Posted in javax.servlet.http No Comments »

Find out session created time in JSP/Servlet

The getCreationTime of HttpSession interface allows us to find out the time in which the session was created in JSP and Servlet.

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		HttpSession session = request.getSession();
		long creationTime = session.getCreationTime();
		
		System.out.println("Session created time = "+creationTime);
	}
Share
AddThis Social Bookmark Button