Session Implicit Object


Prev Tutorial Next Tutorial

Session Implicit Object

In JSP, session is an implicit object of type HttpSession.This object used to set,get or remove attribute or to get session information.

Example of Session implicit object

index.html

Example

<form action="welcome.jsp">  
<input type="text" name="uname">  
<input type="submit" value="go"><br/>  
</form>

welcome.jsp

Example

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

One.jsp

Example

<%   

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

Prev Tutorial Next Tutorial

Advertisements




Facebook Likes

Advertisements