PageContext Class | |
public abstract class PageContext extends Object | |
Object PageContext The PageContext class provides information on the namespaces associated with a JSP including page attributes and implementation details. |
PageContext() | |
public PageContext() | Constructor |
The PageContext classis abstract, so a PageContext object is not created directly. This constructor can be used by sub-classes of PageContext. |
APPLICATION_SCOPE | |
public static final int APPLICATION_SCOPE | Constant |
Used to define scope. |
PAGE_SCOPE | |
public static final int PAGE_SCOPE | Constant |
Used to define scope. |
REQUEST_SCOPE | |
public static final int REQUEST_SCOPE | Constant |
Used to define scope. |
SESSION_SCOPE | |
public static final int SESSION_SCOPE | Constant |
Used to define scope. |
findAttribute() | |
public abstract Object findAttribute(String name) | Method |
findAttribute() searchesthe page, request, session, and application scope for the named attribute and returns its value as an Object or null if the attribute name is not found. |
getAttribute() | |
public abstract Object getAttribute(String name) public abstract Object getAttribute(String name, int scope) |
Method |
getAttribute() searches for thenamed attribute at the specified scope and returns its value as an Object or null if the attribute name is not found. If no scope is specified, the search is performed at page scope. The parameter scope should be one of the scope constants defined above. |
getAttributeNamesInScope() | |
public abstract Enumeration getAttributeNamesInScope(int scope) | Method |
getAttributeNamesInScope()returns an Enumeration containing all of the attribute names in the specified scope. |
getAttributesScope() | |
public abstract int getAttributesScope(String name) | Method |
getAttributesScope() returns the scope of the specified attribute. |
removeAttribute() | |
public abstract void removeAttribute(String name) public abstract void removeAttribute(String name, int scope) |
Method |
removeAttribute() removes the Object associated with the specified attribute name. A scope can also be specified. |
setAttribute() | |
public abstract void setAttribute(String name, Object obj) public abstract void setAttribute(String name, Object obj, int scope) |
Method |
setAttribute() registersthe attribute name and associated Object at the specified scope. If no scope is provided, the attribute is placed at page scope. |
getException() | |
public abstract Exception getException() | Method |
getException() returns any Exception that was passed to the JSP as an error page. |
handlePageException() | |
public abstract void handlePageException(Exception e) throws ServletException, IOException | Method |
handlePageException() is overridden to process a page-level exception. The exception can be re-directed to the specified error page for the JSP or handled inside the method itself. |
forward() | |
public abstract void forward(String relativePath) throws IOException, ServletException | Method |
forward() redirects thecurrent ServletRequest and ServletResponse objects to the target resource at the specified relative URL path. |
getOut() | |
public abstract JspWriter getOut() | Method |
getOut() returns the JspWriter object that is being used for client response. |
include() | |
public abstract void forward(String relativePath) throws IOException, ServletException | Method |
include() causes the resource at the specified relative URL path to be processed as part of the current ServletRequest and ServletResponse objects. |
initialize() | |
public abstract void initialize (Servlet requestingServlet, ServletRequest request, ServletResponse, response, String errorPageURL, boolean needsSession, int buffer, boolean autoFlush) throws IOException, IllegalStateException, IllegalArgumentException |
Method |
initialize() is called to initialize a PageContext object. The errorPageURL is the URL of the error page of the JSP. This can be set to null if there is no error page. The parameter needsSession is true if the JSP is participating in a session. The parameter autoFlush is true if the buffer will automatically flush to the output stream on buffer overflow. |
popBody() | |
public JspWriter popBody() | Method |
popBody() returns the JspWriter object saved by a previous call to pushBody()and updates the "out" attribute at the page scope of the invoking PageContext object. |
pushBody() | |
public BodyCount pushBody() | Method |
pushBody() returns a new BodyCount object, saves the current JspWriter object, and updates the "out" attribute at the page scope of the invoking PageContext object. |
release() | |
public abstract void release() | Method |
release() resets the internal state of the invoking PageContext object by releasing all internal references. This method is usually called by the releasePageContext() method of the JspFactory class. |
getPage() | |
public abstract Object getPage() | Method |
getRequest() | |
public abstract ServletRequest getRequest() | Method |
getRequest() returns the Servlet associated with the invoking PageContext object as an Object. |
getResponse() | |
public abstract ServletResponse getResponse() | Method |
getResponse() returns the ServletResponse object associated with the invoking PageContext object. |
getServletConfig() | |
public abstract ServletConfig getServletConfig() | Method |
getServletConfig() returns the ServletConfig object associated with the invoking PageContext object. |
getServletContext() | |
public abstract ServletContext getServletContext() | Method |
getServletContext() returns the ServletContext object associated with the invoking PageContext object. |
getSession() | |
public abstract HttpSession getSession() | Method |
getSession() returns the HttpSession object associated with the invoking PageContext object. |