|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.servlet.jsp.JspContext
JspContext
serves as the base class for the
PageContext class and abstracts all information that is not specific
to servlets. This allows for Simple Tag Extensions to be used
outside of the context of a request/response Servlet.
The JspContext provides a number of facilities to the page/component author and page implementor, including:
Methods Intended for Container Generated Code
The following methods enable the management of nested JspWriter
streams to implement Tag Extensions: pushBody()
and
popBody()
Methods Intended for JSP authors
The following methods provide convenient access to implicit objects:
getOut()
Field Summary | |
static int |
APPLICATION_SCOPE
Application scope: named reference remains available in the ServletContext until it is reclaimed. |
static int |
PAGE_SCOPE
Page scope: (this is the default) the named reference remains available in this JspContext until the return from the current Servlet.service() invocation. |
static int |
REQUEST_SCOPE
Request scope: the named reference remains available from the ServletRequest associated with the Servlet until the current request is completed. |
static int |
SESSION_SCOPE
Session scope (only valid if this page participates in a session): the named reference remains available from the HttpSession (if any) associated with the Servlet until the HttpSession is invalidated. |
Constructor Summary | |
JspContext()
|
Method Summary | |
abstract java.lang.Object |
findAttribute(java.lang.String name)
Searches for the named attribute in page, request, session (if valid), and application scope(s) in order and returns the value associated or null. |
abstract java.lang.Object |
getAttribute(java.lang.String name)
Returns the object associated with the name in the page scope or null if not found. |
abstract java.lang.Object |
getAttribute(java.lang.String name,
int scope)
Return the object associated with the name in the specified scope or null if not found. |
abstract java.util.Enumeration |
getAttributeNamesInScope(int scope)
Enumerate all the attributes in a given scope |
abstract int |
getAttributesScope(java.lang.String name)
Get the scope where a given attribute is defined. |
abstract ExpressionEvaluator |
getExpressionEvaluator()
Provides programmatic access to the ExpressionEvaluator. |
abstract JspWriter |
getOut()
The current value of the out object (a JspWriter). |
abstract VariableResolver |
getVariableResolver()
Returns an instance of a VariableResolver that provides access to the implicit objects specified in the JSP specification using this JspContext as the context object |
JspWriter |
popBody()
Return the previous JspWriter "out" saved by the matching pushBody(), and update the value of the "out" attribute in the page scope attribute namespace of the JspContext |
JspWriter |
pushBody(java.io.Writer writer)
Return a new JspWriter object that sends output to the provided Writer. |
abstract void |
removeAttribute(java.lang.String name)
Remove the object reference associated with the given name, look in all scopes in the scope order. |
abstract void |
removeAttribute(java.lang.String name,
int scope)
Remove the object reference associated with the specified name in the given scope. |
abstract void |
setAttribute(java.lang.String name,
java.lang.Object attribute)
Register the name and object specified with page scope semantics. |
abstract void |
setAttribute(java.lang.String name,
java.lang.Object o,
int scope)
register the name and object specified with appropriate scope semantics |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int PAGE_SCOPE
public static final int REQUEST_SCOPE
public static final int SESSION_SCOPE
public static final int APPLICATION_SCOPE
Constructor Detail |
public JspContext()
Method Detail |
public abstract void setAttribute(java.lang.String name, java.lang.Object attribute)
name
- the name of the attribute to setattribute
- the object to associate with the name
java.lang.NullPointerException
- if the name or object is nullpublic abstract void setAttribute(java.lang.String name, java.lang.Object o, int scope)
name
- the name of the attribute to seto
- the object to associate with the namescope
- the scope with which to associate the name/object
java.lang.NullPointerException
- if the name or object is null
java.lang.IllegalArgumentException
- if the scope is invalidpublic abstract java.lang.Object getAttribute(java.lang.String name)
name
- the name of the attribute to get
java.lang.NullPointerException
- if the name is nullpublic abstract java.lang.Object getAttribute(java.lang.String name, int scope)
name
- the name of the attribute to setscope
- the scope with which to associate the name/object
java.lang.NullPointerException
- if the name is null
java.lang.IllegalArgumentException
- if the scope is invalidpublic abstract java.lang.Object findAttribute(java.lang.String name)
name
- the name of the attribute to search for
public abstract void removeAttribute(java.lang.String name)
name
- The name of the object to remove.public abstract void removeAttribute(java.lang.String name, int scope)
name
- The name of the object to remove.scope
- The scope where to look.
java.lang.IllegalArgumentException
- if the scope is invalidpublic abstract int getAttributesScope(java.lang.String name)
name
- the name of the attribute to return the scope for
public abstract java.util.Enumeration getAttributeNamesInScope(int scope)
scope
- the scope to enumerate all the attributes for
java.lang.IllegalArgumentException
- if the scope is invalidpublic abstract JspWriter getOut()
public abstract ExpressionEvaluator getExpressionEvaluator()
public abstract VariableResolver getVariableResolver()
public JspWriter pushBody(java.io.Writer writer)
The returned JspWriter must implement all methods and behave as though it were unbuffered. More specifically:
writer
- The Writer for the returned JspWriter to send
output to.
public JspWriter popBody()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |