tagdependent means that your TAGLIB will manage the body content.
text in its own manner. You can have tagdependent as
``empty'' to mean that there is no body content

     <eg:contextPath/>        == out.println( request.getContextPath() )

You should use subclass the `javax.servlet.jsp.tagext.TagSupport' class

Or suppose you written a custom tag to perform an SQL query

     <eg:querySQL>
          SELECT customer_name FROM preferred_customers
     </eg:querySQL>


Then here it the tag `querySQL' must be tagdependent, because your
tag in dependent on the body content, that appears between the
start tag and end tag.

You should use subclass the `javax.servlet.jsp.tagext.BodyTagSupport' class

In particular you have create a `doAfterBody()' method that retrieves the
body content

doAfterBody() {
     BodyContent bc = getBodyContext();
     JspWriter out = getPreviousOut():
     // You perfrom the JDBC query here but I make the string
     // UPPERSCASE here!
     out.write(  bc.getString().toUpperCase() );
     return SKIP_BODY;
}


--
Peter Pilgrim
G.O.A.T
                    "the Greatest Of All Time"



---------------------------------------- Message History 
----------------------------------------


From: Thai Thanh Ha <[EMAIL PROTECTED]>@java.sun.com> on 16/02/2001 12:32 ZE7

Please respond to A mailing list about Java Server Pages specification and             
 reference <[EMAIL PROTECTED]>

DELEGATED - Sent by:     A mailing list about Java Server Pages specification and      
        [EMAIL PROTECTED]>


To:   [EMAIL PROTECTED]
cc:
Subject:  Tag Library Descriptor problem - What does tagdependent mean?


  Hi gurus!

  I have a problem when writing a tag library. The problem is:

  I want to get the content of a custom tag in the corresponding tag
handler, but I don't want that content is displayed in the browser. I have
written:

        <tag>
                <name>testiterationtag</name>
                <tagclass>com.mycompany.TestIterationTag</tagclass>
                <bodycontent>tagdependent</bodycontent>
        </tag>

in my tag library descriptor. And this is the extract from my JSP page:

    <%@ taglib uri="WEB-INF/testtag.tld" prefix="eg" %>
    <eg:testiterationtag>aa</eg:testiterationtag>

  I think "aa" will not be displayed. But it alway is displayed in the
browser.

  So why is it displayed? When should we use the tagdependent value in tag
library descriptor? I can't find any examples using tagdependent value.
Thanks in advance.

  Regards,
  Thai




--

This e-mail may contain confidential and/or privileged information. If you are not the 
intended recipient (or have received this e-mail in error) please notify the sender 
immediately and destroy this e-mail. Any unauthorised copying, disclosure or 
distribution of the material in this e-mail is strictly forbidden.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to