permaculture playing cards
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Doubts in MockExam HFSJ 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 "Doubts in MockExam HFSJ" Watch "Doubts in MockExam HFSJ" New topic

Doubts in MockExam HFSJ

sravanthi pulukuri
Ranch Hand

Joined: Mar 15, 2007
Posts: 125
Which are valid method calls on a PageContext object?
(Choose all that apply.)
A. getAttributeNames()
B. getAttribute(“key”)
C. findAttribute(“key”)
D. getSessionAttribute()
E. getAttributesScope(“key”)
F. findAttribute(“key”, PageContext.SESSION_SCOPE)
G. getAttribute(“key”, PageContext.SESSION_SCOPE)


Couldnt undertsand why E is corerct.

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;

Answer B
Sourin K. Sen
Ranch Hand

Joined: May 02, 2006
Posts: 86

Hi sravanthi,

Here are the answers to your questions :

1. PageContext is a sub-class of JspContext and hence inherits its methods. The methods inherited from JspContext are :
findAttribute, getAttribute, getAttribute, getAttributeNamesInScope, getAttributesScope, getExpressionEvaluator, getOut, getVariableResolver, popBody, pushBody, removeAttribute, removeAttribute, setAttribute, setAttribute

Hence option E is right

2. If you dont need to do any kind of manipulations on the body between the tag, then you dont need to buffer it. You can directly send the control to doAfterBody() method if you need to only print the body. Remeber though, that when you extend the BodyTagSupport class, EVAL_BODY_BUFFERED becomes the default return type of doStartTag() method, but still, its not the only one which can be returned from the method. You still have SKIP_BODY and EVAL_BODY_INCLUDE at your disposal. You will use EVAL_BODY_BUFFERED if and only if you need to do some kind of calculations or manipulations or something particular you want to do the body.

Regards,<br />Sourin.
I agree. Here's the link:
subject: Doubts in MockExam HFSJ
It's not a secret anymore!