Maneesha Jain wrote:
>
> Hi,
>
> In JSP 1.1 Tag Extension,
>
> If I write an Action Tag, that creates a object. And the class's TagExtraInfo
> specifies the scope of that object to be AT_END. How does the scope specified in
> TagExtraInfo  maps to scopes like page, request,session,application ?

Not at all ;-) The scopes in TagExtraInfo (AT_END etc.) only controls where
variables are visible to scripting elements.

Say you have a tag (action element) that introduces a String variable (defined
in the TagExtraInfo class for the action. If you use NESTED, code will be
generated that declares a String and sets it to the current value (by getting it
from the tag handler object) inside the block that represents the body of the
element. This means it can be accessed only by scripting elements in the action
element body.

Simplified example:

  {
    String foo = pageContext.findAttribute("foo");
  }


If you use AT_BEGIN or AT_END, the variable is declared outside the block
representing the body, and code is generated to set its value at appropriate
places (see the spec for details). In this case scripting elements can use
the variable after the action's end tag.

Simplified example:

  String foo = null;
  {
    foo = pageContext.findAttribute("foo");
  }

The page, request, session and application scopes have nothing to do with how
scripting elements can access a variable, really. But some actions, such as
<jsp:useBean> introduces the variable as a scripting variable (as if AT_BEGIN
had been used) as well as saving the variable in the specified scope (i.e. as
an attribute of page, request, session or application/context).

Hans
--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to