aspose file tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes In what methods can we write to the page in case of a BodyTagSupport Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "In what methods can we write to the page in case of a BodyTagSupport" Watch "In what methods can we write to the page in case of a BodyTagSupport" New topic
Author

In what methods can we write to the page in case of a BodyTagSupport

Frits Walraven
Rancher

Joined: Apr 07, 2010
Posts: 1040

If I extend the BodyTagSupport for defining my own classic custom tag.
Can I then write the body to the page-output in any of the following methods?
  • doInitBody()
  • doAfterBody()
  • doEndTag()

  • by using

    Ankit Garg
    Saloon Keeper

    Joined: Aug 03, 2008
    Posts: 9189
        
        2

    Did you try doing this??


    SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
    Frits Walraven
    Rancher

    Joined: Apr 07, 2010
    Posts: 1040

    I have just tried it and the outcome is quite interesting:
  • doInitBody() - not printable
  • doAfterBody() - body printable
  • doEndTag() - body printable

  • It seems that the BodyContent is not available before the first evaluation of the body!

    this was my code (default behaviour of the BodyTagSupport is that the doStartTag() returns EVAL_BODY_BUFFERED so that we are sure that all 3 methods are called)


    The calling JSP:


    and the following TLD entry:


    and the following output:
    doInit()doAfterBody()doEndTag()


     
    I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
     
    subject: In what methods can we write to the page in case of a BodyTagSupport
     
    Similar Threads
    complicate JSP tag : bodyContent
    OO Concept
    Drop-down menus with custom tags in JSP
    Custom JSTL Tag (extending BodyTagSupport) to generate javascript array when pass a java list
    TagSupport class defines xxxValues ?