• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Creator of Enthuware JWS+ V6
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

     
    Sheriff
    Posts: 9707
    43
    Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Did you try doing this??
     
    Frits Walraven
    Creator of Enthuware JWS+ V6
    Posts: 3411
    320
    Android Eclipse IDE Chrome
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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()


     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    reply
      Bookmark Topic Watch Topic
    • New Topic