File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Return type for BodyTagSupport 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 "Return type for BodyTagSupport" Watch "Return type for BodyTagSupport" New topic
Author

Return type for BodyTagSupport

Shobhan Ganta
Ranch Hand

Joined: Nov 11, 2010
Posts: 37
Hi Rachers,

This question is from HFSJ mock exam 10. Q. 9

Given:
10. public class BufTag extends BodyTagSupport {
11. public int doStartTag() throws JspException {
12. // insert code here
13. }
14. }
Assume that the tag has been properly configured to allow body content.
Which, if inserted at line 12, would cause the JSP code
<mytags:mytag>BodyContent</mytags:mytag> to output
BodyContent?
A. return SKIP_BODY;
B. return EVAL_BODY_INCLUDE;
C. return EVAL_BODY_BUFFERED;
D. return BODY_CONTENT;



The correct answer is B. where as I tend to go for option C. the explanantion given is
Option C is invalid because it directs the body of the tag to a buffer which this tag does not process.



Can someone please explain?

Thanks
Shobhan
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1734
    
  25

Hi Shobhan,

Option C is invalid because it directs the body of the tag to a buffer which this tag does not process.

The body is buffered into the BodyContent object and only output to the page if you do so in your TagHandler code:

Regards,
Frits
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Return type for BodyTagSupport