Help coderanch get a
new server
by contributing to the fundraiser
  • 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

Custom Tags

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
public class BuffTag extends BodyTagSupport
{
public int doStartTag() throws JSPException {
//insert code here.

}
}
Assume that the tag has been properly configured to allow body contents. Which, if inserted at line 12, woudl cause the
JSP code <mytags:mytag>BodyContent</mytags:mytag> to output body content?

Options:
A. return SKIP_BODY
B. return EVAL_BODY_INCLUDE
C. return EVAL_BODY_BUFFERED
D. return BODY_CONTENT

Answer is B in head first book. But i think C also correct. Can anyone explain why option B is correct and C is not correct?
 
Ranch Hand
Posts: 437
Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Geeta. If EVAL_BODY_BUFFERED is return, the body of the tag is present in the BodyContent object, the container will not able to evaluate the body(that is present in the BodyContent object). The body will be evaluated only if the method has BodyContent object and if it sees the encapsulated body of it. If we override doAfterBody() with the following code, then we have the body.

If the BodyTagSupport returns EVAL_BODY_INCLUDE, no BodyContent object will be created, and the body will be evaluated.

See this , it will help you.
 
Time is mother nature's way of keeping everything from happening at once. And this is a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic