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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
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
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1672
    
  25

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
    Sheriff

    Joined: Aug 03, 2008
    Posts: 9302
        
      17

    Did you try doing this??


    SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
    Frits Walraven
    Creator of Enthuware JWS+ V6
    Bartender

    Joined: Apr 07, 2010
    Posts: 1672
        
      25

    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://aspose.com/file-tools
     
    subject: In what methods can we write to the page in case of a BodyTagSupport