Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2275
81
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
    Posts: 9509
    22
    Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Did you try doing this??
     
    Frits Walraven
    Creator of Enthuware JWS+ V6
    Saloon Keeper
    Pie
    Posts: 2275
    81
    Android Chrome Eclipse IDE
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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()


     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic