What is the best way to do session and application initialization in a JSP page?

Prasad Thammineni

You can initialize the session and application using the HttpSession.putValue() and ServletContext.setAttribute() methods in a JSP page. The current HttpSession (session) and ServletContext (application) objects are made available implicitely to a JSP page as "session" and "application" objects.

As a best practise you should initialize these objects as part of post-processing in your JSP page or Servlet.