Hello Shruthi,
PageContext is used for storing and retrieving page-related information and sharing objects within the same translation unit and same request. It is also used as a convenience class that maintains a table of all the other implicit objects. For example
try {
...
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
...
} catch (Throwable t) {
...
}
The
Session on the other hand provides a way to identify a user across more than one page request or visit to a Web site and to store information about that user.
The PageContext is provisioned for the scope of processing a page (Request) and is short lived compared to a session.
Regards,