pageContext | |
Variable name: | |
pageContext |
|
Class name: | |
javax.servlet.jsp.PageContext |
|
Extends: | |
None |
|
Implements: | |
None |
|
Implemented by: | |
A concrete subclass of this abstract class is provided as an internal container-dependent class. |
|
JSP page type: | |
Available in both regular JSP pages and error pages |
|
Description | |
A PageContext instance provides access to all the JSP scopes and several page attributes, and offers a layer above the container-implementation details to enable a container to generate portable JSP implementation classes. The JSP page scope is represented by PageContext attributes. A unique instance of this object is created by the web container and assigned to the pageContext variable for each request. |
|
Constants | |
public static final int PAGE_SCOPE = 1; public static final int REQUEST_SCOPE = 2; public static final int SESSION_SCOPE = 3; public static final int APPLICATION_SCOPE = 4; |
findAttribute() | |
public abstract Object findAttribute(String name) | |
Searches for the named attribute in the page, request, session (if valid), and application scope(s) in order and returns the associated value. If the attribute is not found, returns null. |
forward() | |
public abstract void forward(String relativeUrlPath) throws ServletException, java.io.IOException |
|
Forwards the current request to another active component in the application, such as a servlet or JSP page. If the specified URI starts with a slash, it's interpreted as a context-relative path; otherwise, it's interpreted as a page-relative path. The response must not be modified after calling this method, since the response is committed before this method returns. |
getAttribute() | |
public abstract Object getAttribute(String name) | |
Returns the Object associated with the specified attribute name in the page scope, or null if the attribute is not found. |
getAttribute() | |
public abstract Object getAttribute(String name, int scope) | |
Returns the Object associated with the specified attribute name in the specified scope, or null if the attribute is not found. The scope argument must be one of the int values specified by the PageContext static scope variables. |
getAttributeNamesInScope() | |
public abstract java.util.Enumeration getAttributeNamesInScope(int scope) | |
Returns an Enumeration of String objects containing all the attribute names for the specified scope. The scope argument must be one of the int values specified by the PageContext static scope variables. |
getAttributesScope() | |
public abstract int getAttributesScope(String name) | |
Returns one of the int values specified by the PageContext static scope variables for the scope of the object associated with the specified attribute name, or 0 if the attribute is not found. |
getException() | |
public abstract Exception getException() | |
Returns the Exception that caused the current page to be invoked if its page directive isErrorPage attribute is set to true. |
getOut() | |
public abstract JspWriter getOut() | |
Returns the current JspWriter for the page. When this method is called by a tag handler that implements BodyTag or is nested in the body of another action element, the returned object may be an instance of the BodyContent subclass. |
getPage() | |
public abstract Object getPage() | |
Returns the Object that represents the JSP page implementation class instance with which this PageContext is associated. |
getRequest() | |
public abstract ServletRequest getRequest() | |
Returns the current ServletRequest. |
getResponse() | |
public abstract ServletResponse getResponse() | |
Returns the current ServletResponse. |
getServletConfig() | |
public abstract ServletConfig getServletConfig() | |
Returns the ServletConfig for this JSP page implementation class instance. |
getServletContext() | |
public abstract ServletContext getServletContext() | |
Returns the ServletContext for this JSP page implementation class instance. |
getSession() | |
public abstract HttpSession getSession() | |
Returns the current HttpSession, or null if the page directive session attribute is set to false. |
handlePageException() | |
public abstract void handlePageException(Exception e) throws ServletException, java.io.IOException |
|
This method is intended to be called by the JSP page implementation class only to process unhandled exceptions, either by forwarding the request exception to the error page specified by the page directive errorPage attribute or by performing an implementation-dependent action (if no error page is specified). |
include() | |
public abstract void include(String relativeUrlPath) throws ServletException, java.io.IOException |
|
Causes the specified resource to be processed as part of the current request. The current JspWriter is flushed before invoking the target resource, and the output of the target resource's processing of the request is written directly to the current ServletResponse object's writer. If the specified URI starts with a slash, it's interpreted as a context-relative path; otherwise, it's interpreted as a page-relative path. |
initialize() | |
public abstract void initialize(Servlet servlet, ServletRequest request, ServletResponse response, String errorPageURL, boolean needsSession, int bufferSize, boolean autoFlush) throws java.io.IOException, IllegalStateException, IllegalArgumentException |
|
This method is called to initialize a PageContext object so that it may be used by a JSP implementation class to service an incoming request. This method is typically called from the JspFactory.getPageContext() method. |
popBody() | |
public JspWriter popBody() | |
This method is intended to be called by the JSP page implementation class only to reassign the previous JspWriter, saved by the matching pushBody() method, as the current JspWriter. |
pushBody() | |
public BodyContent pushBody() | |
This method is intended to be called by the JSP page implementation class only to get a new BodyContent object and save the current JspWriter on the PageContext object's internal stack. |
release() | |
public abstract void release() | |
Resets the internal state of a PageContext, releasing all internal references and preparing the PageContext for potential reuse by a later invocation of initialize(). This method is typically called from the JspFactory.releasePageContext() method. |
removeAttribute() | |
public abstract void removeAttribute(String name) public abstract void removeAttribute(String name, int scope) |
|
Removes the object reference associated with the specified attribute name in the page scope or in the specified scope. The scope argument must be one of the int values specified by the PageContext static scope variables.. |
setAttribute() | |
public abstract void setAttribute(String name, Object attribute) public abstract void setAttribute(String name, Object o, int scope) |
|
Saves the specified attribute name and object in the page scope or in the specified scope. The scope argument must be one of the int values specified by the PageContext static scope variables. |
PageContext() | |
public PageContext() | |
Creates an instance of the PageContext class. Typically, the JspFactory class creates and initializes the instance. |