A PageContext is an object that provides a context to store references to objects used by the page, encapsulates implementation-dependent features, and provides convenience methods. A JSP page implementation class can use a PageContext to run unmodified in any compliant JSP container while taking advantage of implementation-specific improvements like high performance JspWriters.
The PageContext provides a number of facilities to the page/component author and page implementor, including:
a single API to manage the various scoped namespaces
a number of convenience API's to access various public objects
a mechanism to obtain the JspWriter for output
a mechanism to manage session usage by the page
a mechanism to expose page directive attributes to the scripting environment
mechanisms to forward or include the current request to other active components in the application
a mechanism to handle errorpage exception processing
public abstract class JspContext { public abstract void setAttribute(String name, Object value); public abstract void setAttribute(String name, Object value, int scope); public abstract Object getAttribute(String name); public abstract Object getAttribute(String name, int scope); public abstract Object findAttribute(String name); public abstract void removeAttribute(String name); public abstract void removeAttribute(String name, int scope); public abstract int getAttributesScope(String name); public abstract Enumeration getAttributeNamesInScope(int scope); public abstract JspWriter getOut(); }
public abstract class PageContext extends JspContext { public abstract javax.servlet.http.HttpSession getSession(); public abstract java.lang.Object getPage(); public abstract javax.servlet.ServletRequest getRequest(); public abstract javax.servlet.ServletResponse getResponse(); public abstract java.lang.Exception getException(); public abstract javax.servlet.ServletConfig getServletConfig(); public abstract javax.servlet.ServletContext getServletContext(); public abstract void forward(java.lang.String relativeUrlPath) throws javax.servlet.ServletException, java.io.IOException; public abstract void include(java.lang.String relativeUrlPath) throws javax.servlet.ServletException, java.io.IOException; public abstract void handlePageException(java.lang.Exception e) throws javax.servlet.ServletException, java.io.IOException; }
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |