pageContext.getAttribute(“foo”);
getPageContext().getAttribute(“foo”);
pageContext.getApplicationScope(“foo”);
pageContext.getAttribute(“foo”,pageContext.APPLICATION_SCOPE).getAttribute(“foo”);
getPageContext().getScope(pageContext.APPLICATION_SCOPE).getAttribute(“foo”);
第1题:
GiventheJSPcode:<%request.setAttribute("foo","bar");%>andtheClassictaghandlercode:5.publicintdoStartTag()throwsJspException{6.//insertcodehere7.//returnint8.}Assumetherearenoother"foo"attributesinthewebapplication.WhichinvocationonthepageContextobject,insertedatline6,assigns"bar"tothevariablex?()
A.Stringx=(String)pageContext.getAttribute("foo")
B.Stringx=(String)pageContext.getRequestScope("foo")
C.ItisNOTpossibletoaccessthepageContextobjectfromwithindoStartTag
D.Stringx=(String)pageContext.getRequest().getAttribute("foo")
E.Stringx=(String)pageContext.getAttribute("foo",PageContext.ANY_SCOPE)
第2题:
A custom JSP tag must be able to support an arbitrary number of attributes whose names are unknown when the tag class is designed. Which two are true? ()
第3题:
A.pageContext.getAttribute(“foo”);
B.getPageContext().getAttribute(“foo”);
C.pageContext.getApplicationScope(“foo”);
D.pageContext.getAttribute(“foo”,pageContext.APPLICATION_SCOPE).getAttribute(“foo”);
E.getPageContext().getScope(pageContext.APPLICATION_SCOPE).getAttribute(“foo”);
第4题:
Assume the tag handler for a st:simple tag extends Simple Tag Support. In what way can scriptlet code beused in the body of st:simple?()
第5题:
Given: 6.
第6题:
Given: 3.public class MyTagHandler extends TagSupport { 4.public int doStartTag() { 5.// insert code here 6.// return an int 7.} 8.// more code here ... 18.} There is a single attribute foo in the session scope. Which three code fragments,inserted independently atline 5,return the value of the attribute?()
第7题:
class One { void foo() {} } class Two extends One { //insert method here } Which three methods, inserted individually at line 14, will correctly complete class Two?()
第8题:
Given:3.publicclassMyTagHandlerextendsTagSupport{4.publicintdoStartTag(){5.//insertcodehere6.//returnanint7.}8.//morecodehere...18.}Thereisasingleattributefoointhesessionscope.Whichthreecodefragments,insertedindependentlyatline5,returnthevalueoftheattribute?()
A.Objecto=pageContext.getAttribute("foo");
B.Objecto=pageContext.findAttribute("foo");
C.Objecto=pageContext.getAttribute("foo",PageContext.SESSION_SCOPE);
D.HttpSessions=pageContext.getSession();Objecto=s.getAttribute("foo");
第9题:
Assume a tag handler extends TagSupport. Which is used within the tag handler to get an attribute “foo” that is in the application scope?()
第10题:
class One { public One foo() { return this; } } class Two extends One { public One foo() { return this; } } class Three extends Two { // insert method here } Which two methods, inserted individually, correctly complete the Three class?()