Which code snippet, inserted at line 8, causes the value foo to be output?

Given:
5. public class MyTagHandler extends TagSupport {
6. public int doStartTag() throws JspException {

7. try {
8. // insert code here
9. } catch(Exception ex) { /* handle exception */ }
10. return super.doStartTag();
11. }

42. }
Which code snippet, inserted at line 8, causes the value foo to be output?

Given:
5. public class MyTagHandler extends TagSupport {
6. public int doStartTag() throws JspException {

7. try {
8. // insert code here
9. } catch(Exception ex) { /* handle exception */ }
10. return super.doStartTag();
11. }

42. }
Which code snippet, inserted at line 8, causes the value foo to be output?

A.
JspWriter w = pageContext.getOut();

B.
print(“foo”);

C.
JspWriter w = pageContext.getWriter();

D.
print(“foo”);

E.
JspWriter w = new JspWriter(pageContext.getWriter());

F.
print(“foo”);

G.
JspWriter w = new JspWriter(pageContext.getResponse());

H.
print(“foo”);

Explanation:



Leave a Reply 1

Your email address will not be published. Required fields are marked *


Mauricio Cuellar

Mauricio Cuellar

missing w.print(“foo”);