aspose file tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Custom Tags Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Custom Tags" Watch "Custom Tags" New topic

Custom Tags

Geetha Arthanari

Joined: Nov 24, 2006
Posts: 25
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?

A. return SKIP_BODY

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?
Chinmaya Chowdary
Ranch Hand

Joined: Apr 21, 2008
Posts: 432
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.
It is sorta covered in the JavaRanch Style Guide.
subject: Custom Tags