• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Questions about Tag Cassic [First Heard - Servlet & JSP]

 
Erick Macedo
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good morning
I'm more a question about a subject matter in the book is on page 539.A Doubt Tag Classic, the book reads.
The Class TagSupport assumes that your tag does not have a body SKIP_BODY returned from doStartTag (), and that if there is ACTUALLY a body being evaluated, you want it to be evaluated only once SKIP_BODY returning from doAfterBody ()


Guys, got my confused, because by default if the doStartTag returns ALWAYS SKIP_BODY, then the body is never evaluated, then because he says that if a body it will be for STANDARD, RATED once?

grateful
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2173
57
Android Chrome Eclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Erick,

What they are trying to say is that if there is no body in your tag then the default path will be (doStartTag() -> SKIP_BODY -> doEndTag() -> EVAL_PAGE) and if there is a body available it will follow the path (doStartTag() -> EVAL_BODY_INCLUDE -> doAfterBody() -> SKIP_BODY -> doEndTag() -> EVAL_PAGE)

Just check my notes in the SCWCD links (chapter 8.5.2 IterationTag and TagSupport) and the graph might explain it better than words.

Regards,
Frits
 
Erick Macedo
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Frits, Thanks for your attention.

Really, that's what I did over the book still speaks the following in page 539.

You MUST replace the doStartTag () if you want the body of the tag is evaluated!


That is, if there is a possibility the body is evaluated by default, because I'll have to override the method mandatory(MUST)?
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2173
57
Android Chrome Eclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is, if there is a possibility the body is evaluated by default, because I'll have to override the method mandatory(MUST)?

Ok, let me rephrase my answer a bit:

The default behaviour of the TagSupport class is:
  • doStartTag() -> SKIP_BODY -> doEndTag() -> EVAL_PAGE
  • No matter whether you have a body or not!

    If you have a body in your tag and you override the doStartTag() to return EVAL_BODY_INCLUDE the remaining default functionality will be:
  • doAfterBody() -> SKIP_BODY -> doEndTag() -> EVAL_PAGE
  • In this case the body will then be evaluated once, so if you want to iterate multiple times you will have to override the doAfterbody() as well

    Regards,
    Frits
     
    Erick Macedo
    Greenhorn
    Posts: 16
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Now I understand it, is that I thought that the tag had a body to change the default behavior is to understand what went with the words of the book.

    The Class TagSupport assumes that your tag does not have a body SKIP_BODY returned from doStartTag (), and that if there is ACTUALLY a body being evaluated, you want it to be evaluated only once SKIP_BODY returning from doAfterBody ()


    More with your words I understand.

    thank you
     
    I agree. Here's the link: http://aspose.com/file-tools
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic