javax.servlet.jsp
abstract public class: JspContext [javadoc |
source]
java.lang.Object
javax.servlet.jsp.JspContext
Direct Known Subclasses:
PageContext
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:
- a single API to manage the various scoped namespaces
- a mechanism to obtain the JspWriter for output
- a mechanism to expose page directive attributes to the
scripting environment
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
Some methods provide uniform access to the diverse objects
representing scopes.
The implementation must use the underlying machinery
corresponding to that scope, so information can be passed back and
forth between the underlying environment (e.g. Servlets) and JSP pages.
The methods are:
setAttribute()
, getAttribute()
,
findAttribute()
, removeAttribute()
,
getAttributesScope()
and
getAttributeNamesInScope()
.
The following methods provide convenient access to implicit objects:
getOut()
The following methods provide programmatic access to the
Expression Language evaluator:
getExpressionEvaluator()
, getVariableResolver()
Constructor: |
public JspContext() {
}
Sole constructor. (For invocation by subclass constructors,
typically implicit.) |
Method from javax.servlet.jsp.JspContext Summary: |
---|
findAttribute, getAttribute, getAttribute, getAttributeNamesInScope, getAttributesScope, getELContext, getExpressionEvaluator, getOut, getVariableResolver, popBody, pushBody, removeAttribute, removeAttribute, setAttribute, setAttribute |
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from javax.servlet.jsp.JspContext Detail: |
abstract public Object findAttribute(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 public Object getAttribute(String name)
Returns the object associated with the name in the page scope or null
if not found. |
abstract public Object getAttribute(String name,
int scope)
Return the object associated with the name in the specified
scope or null if not found. |
abstract public Enumeration<String> getAttributeNamesInScope(int scope)
Enumerate all the attributes in a given scope. |
abstract public int getAttributesScope(String name)
Get the scope where a given attribute is defined. |
abstract public ELContext getELContext()
|
abstract public ExpressionEvaluator getExpressionEvaluator()Deprecated! As - of JSP 2.1, replaced by
JspApplicationContext.getExpressionFactory()
Provides programmatic access to the ExpressionEvaluator.
The JSP Container must return a valid instance of an
ExpressionEvaluator that can parse EL expressions. |
abstract public JspWriter getOut()
The current value of the out object (a JspWriter). |
abstract public VariableResolver getVariableResolver()Deprecated! As - of JSP 2.1,
replaced by javax.el.ELContext.getELResolver()
which can be obtained by
jspContext.getELContext().getELResolver()
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. |
public JspWriter popBody() {
return null; // XXX to implement
}
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. |
public JspWriter pushBody(Writer writer) {
return null; // XXX to implement
}
Return a new JspWriter object that sends output to the
provided Writer. Saves the current "out" JspWriter,
and updates the value of the "out" attribute in the
page scope attribute namespace of the JspContext.
The returned JspWriter must implement all methods and
behave as though it were unbuffered. More specifically:
- clear() must throw an IOException
- clearBuffer() does nothing
- getBufferSize() always returns 0
- getRemaining() always returns 0
|
abstract public void removeAttribute(String name)
Remove the object reference associated with the given name
from all scopes. Does nothing if there is no such object. |
abstract public void removeAttribute(String name,
int scope)
Remove the object reference associated with the specified name
in the given scope. Does nothing if there is no such object. |
abstract public void setAttribute(String name,
Object value)
Register the name and value specified with page scope semantics.
If the value passed in is null , this has the same
effect as calling
removeAttribute( name, PageContext.PAGE_SCOPE ) . |
abstract public void setAttribute(String name,
Object value,
int scope)
Register the name and value specified with appropriate
scope semantics. If the value passed in is null ,
this has the same effect as calling
removeAttribute( name, scope ) . |