In JSP, pageContext is an instance of javax.servlet.jsp.PageContext.
Using this object you can set,get or remove attribute from one of the following scopes:
<!DOCTYPE html>
<html>
<head>
<title>pageContext Implicit Object</title>
</head>
<body>
<form action="process.jsp">
<input type="text" placeholder="first name" name="userid"> <br><br>
<input type="text" placeholder="last name" name="password"> <br> <br>
<input type="submit" value="submit"><br>
</form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>JSP PagContext </title>
</head>
<body>
<%
String userid=request.getParameter("userid");
String password=request.getParameter("password");
out.println("Hello :"+userid);
pageContext.setAttribute("UserName", userid, PageContext.SESSION_SCOPE);
pageContext.setAttribute("UserPassword", password, PageContext.SESSION_SCOPE);
%>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>JSP PagContext </title>
</head>
<body>
<%
String username= (String) pageContext.getAttribute("UserName", PageContext.SESSION_SCOPE);
String userpassword= (String) pageContext.getAttribute("UserPassword", PageContext.SESSION_SCOPE);
out.println("Hi "+username+" you enter");
out.println("<br><br>");
out.println("Userid :"+username);
out.println("<br>");
out.println("Password :"+userpassword);
%>
</body>
</html>