for a tag handler implementing
, and after
for a tag
Often two actions in a JSP page want to cooperate, perhaps by one action creating some
server side object that is used by the other. There are two basic mechanisms in the JSP
specification to achieve this.
Ids and PageContext.
One mechanism for supporting cooperation among actions is by giving the object a name
within the JSP page; the first action creates and names the object while the second action
uses the name to retrieve the object.
For example, in the following JSP page fragment the
action creates a server side object
and give it the name myObject . Then the
action accesses that server side object and
takes some action.
In a JSP container implementation, the mapping between the name and the value is kept by
the implicit object pageContext. This object is passed around through the tag handler
instances so it can be used to communicate information: all it is needed is to know the name
under which the information is stored into the pageContext.
Run Time Stack
An alternative to explicit communication of information through a named object is implicit
coordination based on syntactic scoping.
For example, in the following JSP page fragment the foo action might create a server side
object; later the nested bar action might access that server side object. The object is not
named within the pageContext: it is found because the specific foo element is the closest
enclosing instance of a known element type.
JavaServer Pages 1.1 Specification
November 30, 1999