- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is a pageContext Object in JSP?
The pageContext object is an instance of a javax.servlet.jsp.PageContext object. The pageContext object is used to represent the entire JSP page.
This object is intended as a means to access information about the page while avoiding most of the implementation details.
This object stores references to the request and response objects for each request. The application, config, session, and out objects are derived by accessing attributes of this object.
The pageContext object also contains information about the directives issued to the JSP page, including the buffering information, the errorPageURL, and page scope.
The PageContext class defines several fields, including PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, and APPLICATION_SCOPE, which identify the four scopes. It also supports more than 40 methods, about half of which are inherited from the javax.servlet.jsp.JspContext class.
One of the important methods is removeAttribute. This method accepts either one or two arguments. For example, pageContext.removeAttribute ("attrName") removes the attribute from all scopes, while the following code only removes it from the page scope −
pageContext.removeAttribute("attrName", PAGE_SCOPE);
- Related Articles
- What is a request object in JSP?
- What is a response object in JSP?
- What is a config Object in JSP?
- What is a page object in JSP?
- What is the session Object in JSP?
- What is an application Object in JSP?
- What is an exception Object in JSP? What type of exceptions can occur in a JSP page?
- What is the out implicit object in JSP?
- What is the use of page object in JSP? Need an example.
- What methods of session object is used frequently in JSP and for what purpose?
- What is a page directive in JSP?
- What is a buffer attribute in JSP?
- What is a include directive in JSP?
- What is a taglib directive in JSP?
- What is a scriptlet in JSP and what is its syntax?
