In JSP, session is an implicit object of type HttpSession.The Java developer can use this object to set,get or remove attribute or to get session information.

Example of session implicit object

index.html

  
  

welcome.jsp

  
  
<%   
  
String name=request.getParameter("uname");  
out.print("Welcome "+name);  
  
session.setAttribute("user",name);  
  
second jsp page  
  
%>  
  
  

second.jsp

  
  
<%   
  
String name=(String)session.getAttribute("user");  
out.print("Hello "+name);  
  
%>  
  
  

Output

jsp session implicit object output 1 jsp session implicit object output 2 jsp session implicit object output 3