Java Doc for Tag.java in  » 6.0-JDK-Core » Servlet-API-by-tomcat » javax » servlet » jsp » tagext » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » Servlet API by tomcat » javax.servlet.jsp.tagext 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.servlet.jsp.tagext.Tag

All known Subclasses:   javax.servlet.jsp.tagext.TagAdapter,
Tag
public interface Tag extends JspTag(Code)
The interface of a classic tag handler that does not want to manipulate its body. The Tag interface defines the basic protocol between a Tag handler and JSP page implementation class. It defines the life cycle and the methods to be invoked at start and end tag.

Properties

The Tag interface specifies the setter and getter methods for the core pageContext and parent properties.

The JSP page implementation object invokes setPageContext and setParent, in that order, before invoking doStartTag() or doEndTag().

Methods

There are two main actions: doStartTag and doEndTag. Once all appropriate properties have been initialized, the doStartTag and doEndTag methods can be invoked on the tag handler. Between these invocations, the tag handler is assumed to hold a state that must be preserved. After the doEndTag invocation, the tag handler is available for further invocations (and it is expected to have retained its properties).

Lifecycle

Lifecycle details are described by the transition diagram below, with the following comments:

  • [1] This transition is intended to be for releasing long-term data. no guarantees are assumed on whether any properties have been retained or not.
  • [2] This transition happens if and only if the tag ends normally without raising an exception
  • [3] Some setters may be called again before a tag handler is reused. For instance, setParent() is called if it's reused within the same page but at a different level, setPageContext() is called if it's used in another page, and attribute setters are called if the values differ or are expressed as request-time attribute values.
  • Check the TryCatchFinally interface for additional details related to exception handling and resource management.

Lifecycle Details Transition Diagram for Tag

Once all invocations on the tag handler are completed, the release method is invoked on it. Once a release method is invoked all properties, including parent and pageContext, are assumed to have been reset to an unspecified value. The page compiler guarantees that release() will be invoked on the Tag handler before the handler is released to the GC.

Empty and Non-Empty Action

If the TagLibraryDescriptor file indicates that the action must always have an empty action, by an <body-content> entry of "empty", then the doStartTag() method must return SKIP_BODY.

Otherwise, the doStartTag() method may return SKIP_BODY or EVAL_BODY_INCLUDE.

If SKIP_BODY is returned the body, if present, is not evaluated.

If EVAL_BODY_INCLUDE is returned, the body is evaluated and "passed through" to the current out.



Field Summary
final public static  intEVAL_BODY_INCLUDE
     Evaluate body into existing out stream.
final public static  intEVAL_PAGE
     Continue evaluating the page.
final public static  intSKIP_BODY
     Skip body evaluation.
final public static  intSKIP_PAGE
     Skip the rest of the page.


Method Summary
 intdoEndTag()
     Process the end tag for this instance. This method is invoked by the JSP page implementation object on all Tag handlers.

This method will be called after returning from doStartTag.

 intdoStartTag()
     Process the start tag for this instance. This method is invoked by the JSP page implementation object.

The doStartTag method assumes that the properties pageContext and parent have been set.

 TaggetParent()
     Get the parent (closest enclosing tag handler) for this tag handler.

The getParent() method can be used to navigate the nested tag handler structure at runtime for cooperation among custom actions; for example, the findAncestorWithClass() method in TagSupport provides a convenient way of doing this.

The current version of the specification only provides one formal way of indicating the observable type of a tag handler: its tag handler implementation class, described in the tag-class subelement of the tag element.

 voidrelease()
     Called on a Tag handler to release state.
 voidsetPageContext(PageContext pc)
     Set the current page context.
 voidsetParent(Tag t)
     Set the parent (closest enclosing tag handler) of this tag handler.

Field Detail
EVAL_BODY_INCLUDE
final public static int EVAL_BODY_INCLUDE(Code)
Evaluate body into existing out stream. Valid return value for doStartTag.



EVAL_PAGE
final public static int EVAL_PAGE(Code)
Continue evaluating the page. Valid return value for doEndTag().



SKIP_BODY
final public static int SKIP_BODY(Code)
Skip body evaluation. Valid return value for doStartTag and doAfterBody.



SKIP_PAGE
final public static int SKIP_PAGE(Code)
Skip the rest of the page. Valid return value for doEndTag.





Method Detail
doEndTag
int doEndTag() throws JspException(Code)
Process the end tag for this instance. This method is invoked by the JSP page implementation object on all Tag handlers.

This method will be called after returning from doStartTag. The body of the action may or may not have been evaluated, depending on the return value of doStartTag.

If this method returns EVAL_PAGE, the rest of the page continues to be evaluated. If this method returns SKIP_PAGE, the rest of the page is not evaluated, the request is completed, and the doEndTag() methods of enclosing tags are not invoked. If this request was forwarded or included from another page (or Servlet), only the current page evaluation is stopped.

The JSP container will resynchronize the values of any AT_BEGIN and AT_END variables (defined by the associated TagExtraInfo or TLD) after the invocation of doEndTag(). indication of whether to continue evaluating the JSP page.
throws:
  JspException - if an error occurred while processing this tag




doStartTag
int doStartTag() throws JspException(Code)
Process the start tag for this instance. This method is invoked by the JSP page implementation object.

The doStartTag method assumes that the properties pageContext and parent have been set. It also assumes that any properties exposed as attributes have been set too. When this method is invoked, the body has not yet been evaluated.

This method returns Tag.EVAL_BODY_INCLUDE or BodyTag.EVAL_BODY_BUFFERED to indicate that the body of the action should be evaluated or SKIP_BODY to indicate otherwise.

When a Tag returns EVAL_BODY_INCLUDE the result of evaluating the body (if any) is included into the current "out" JspWriter as it happens and then doEndTag() is invoked.

BodyTag.EVAL_BODY_BUFFERED is only valid if the tag handler implements BodyTag.

The JSP container will resynchronize the values of any AT_BEGIN and NESTED variables (defined by the associated TagExtraInfo or TLD) after the invocation of doStartTag(), except for a tag handler implementing BodyTag whose doStartTag() method returns BodyTag.EVAL_BODY_BUFFERED. EVAL_BODY_INCLUDE if the tag wants to process body, SKIP_BODY if it does not want to process it.
throws:
  JspException - if an error occurred while processing this tag
See Also:   BodyTag




getParent
Tag getParent()(Code)
Get the parent (closest enclosing tag handler) for this tag handler.

The getParent() method can be used to navigate the nested tag handler structure at runtime for cooperation among custom actions; for example, the findAncestorWithClass() method in TagSupport provides a convenient way of doing this.

The current version of the specification only provides one formal way of indicating the observable type of a tag handler: its tag handler implementation class, described in the tag-class subelement of the tag element. This is extended in an informal manner by allowing the tag library author to indicate in the description subelement an observable type. The type should be a subtype of the tag handler implementation class or void. This addititional constraint can be exploited by a specialized container that knows about that specific tag library, as in the case of the JSP standard tag library. the current parent, or null if none.
See Also:   TagSupport.findAncestorWithClass




release
void release()(Code)
Called on a Tag handler to release state. The page compiler guarantees that JSP page implementation objects will invoke this method on all tag handlers, but there may be multiple invocations on doStartTag and doEndTag in between.



setPageContext
void setPageContext(PageContext pc)(Code)
Set the current page context. This method is invoked by the JSP page implementation object prior to doStartTag().

This value is *not* reset by doEndTag() and must be explicitly reset by a page implementation if it changes between calls to doStartTag().
Parameters:
  pc - The page context for this tag handler.




setParent
void setParent(Tag t)(Code)
Set the parent (closest enclosing tag handler) of this tag handler. Invoked by the JSP page implementation object prior to doStartTag().

This value is *not* reset by doEndTag() and must be explicitly reset by a page implementation.
Parameters:
  t - The parent tag, or null.




www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.