JSP session implicit object

The session is an implicit object of type javax.servlet.http.HttpSession and behaves exactly the same way that session object behave in Servlets. The developer use this object to set, get or remove attribute or to get session information.
Example;

index.html

<html>
<body>
<form action="welcome2.jsp">
<input type="text" name="uname">
<input type="submit" value="ok">
</form>
</body>
</html>

welcome2.jsp

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

welcome3.jsp

<html>
<body>
<%
String str=(String)session.getAttribute("user");
out.print("Hii "+str);
%>
</body>
</html>

Our Services:

Java Training | Python Training | Machine Learning with Python Training | Deep Learning with Python Training | Data Science with Python Training | Projects

SILAN Technology, BBSR
Call to: 0674-2361252

Comment