aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Questions about Tag Cassic [First Heard - Servlet & JSP] 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 "Questions about Tag Cassic [First Heard - Servlet & JSP]" Watch "Questions about Tag Cassic [First Heard - Servlet & JSP]" New topic
Author

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

Erick Macedo
Greenhorn

Joined: Feb 17, 2013
Posts: 14
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
Bartender

Joined: Apr 07, 2010
Posts: 1716
    
  25

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

Joined: Feb 17, 2013
Posts: 14
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
Bartender

Joined: Apr 07, 2010
Posts: 1716
    
  25

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

    Joined: Feb 17, 2013
    Posts: 14
    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
     
    Consider Paul's rocket mass heater.
     
    subject: Questions about Tag Cassic [First Heard - Servlet & JSP]