单选题Assume a tag handler extends TagSupport. Which is used within the tag handler to get an attribute “foo” that is in the application scope?()ApageContext.getAttribute(“foo”);BgetPageContext().getAttribute(“foo”);CpageContext.getApplicationScope(“foo”);Dp

题目
单选题
Assume a tag handler extends TagSupport. Which is used within the tag handler to get an attribute “foo” that is in the application scope?()
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”);


相似考题
更多“单选题Assume a tag handler extends TagSupport. Which is used within the tag handler to get an attribute “foo” that is in the application scope?()A  pageContext.getAttribute(“foo”);B  getPageContext().getAttribute(“foo”);C  pageContext.getApplicationScope(“fo”相关问题
  • 第1题:

    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? ()

    • A、 A  element in the echo tag LTD must have the value JSP
    • B、 The echo tag handler must define the setAttribute (String key, String value) method
    • C、 The true element must appear in the echo tag TLD
    • D、 The class implementing the echo tag handler must implement the javax.sevlet.jsp.tagext.IterationTag interface
    • E、 The class implementing the echo tag handler must implement the javax.sevlet.jsp.tagext.DynamicAttributes interface

    正确答案:C,E

  • 第2题:

    Given: 6. 7.<%="processing" %> 8. and a custom tag handler for foo which extends TagSupport. Which two are true about thetag handler referenced by foo?()

    • A、The doStartTag method is called once.
    • B、The doAfterBody method is NOT called.
    • C、The EVAL_PAGE constant is a valid return value for the doEndTag method.
    • D、The SKIP_PAGE constant is a valid return value for the doStartTag method.
    • E、The EVAL_BODY_BUFFERED constant is a valid return value for the doStartTag method.

    正确答案:A,C

  • 第3题:

    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?()

    • A、Set the body content type to JSP in the TLD
    • B、Scriptlet code is NOT legal in the body of st:simple.
    • C、Add scripting-enabled="true" to the start tag for the st:simple element
    • D、Add a pass-through Classic tag with a body content type of JSP to the body of st:simple, and place the scriptlet code in the body of that tag

    正确答案:B

  • 第4题:

    A custom tag is defined to take three attributes. Which two correctly invoke the tag within a JSP page?()

    • A、<prefix:myTag a="foo" b="bar" c="baz" />
    • B、<prefix:myTag attributes={"foo","bar","baz"} />
    • C、<prefix:myTag jsp:attribute a="foo" b="bar" c="baz" />
    • D、<prefix:myTag><jsp:attribute name="a">foo</jsp:attribute><jsp:attribute name="b">bar</jsp:attribute><jsp:attribute name="c">baz</jsp:attribute>. </prefix:myTag>

    正确答案:A,B,D

  • 第5题:

    Given the JSP code: <% request.setAttribute("foo", "bar"); %>and the Classic tag handler code: 5. public int doStartTag() throws JspException { 6. // insert code here 7. // return int 8. } Assume there are no other "foo" attributes in the web application. Which invocation on the pageContextobject,inserted at line 6,assigns "bar" to the variable x?()

    • A、String x = (String) pageContext.getAttribute("foo")
    • B、String x = (String) pageContext.getRequestScope("foo")
    • C、It is NOT possible to access the pageContext object from within doStartTag
    • D、String x = (String) pageContext.getRequest().getAttribute("foo")
    • E、String x = (String) pageContext.getAttribute("foo", PageContext.ANY_SCOPE)

    正确答案:D

  • 第6题:

    单选题
    The sl:shoppingList and sl:item tags output a shopping list to the response and are used as follows: 11. 12. 13. 14. 15. The tag handler for sl:shoppingList is ShoppingListTag and the tag handler for sl:item is ItemSimpleTag.ShoppingListTag extends BodyTagSupport and ItemSimpleTag extends SimpleTagSupport.Which is true?()
    A

    ItemSimpleTag can find the enclosing instance of ShoppingListTag by calling getParent() and castingthe result to ShoppingListTag.

    B

    ShoppingListTag can find the child instances of ItemSimpleTag by calling super.getChildren() andcasting each to an ItemSimpleTag.

    C

    It is impossible for ItemSimpleTag and ShoppingListTag to find each other in a tag hierarchy becauseone is a Simple tag and the other is a Classic tag.

    D

    ShoppingListTag can find the child instances of ItemSimpleTag by calling getChildren() on thePageContext and casting each to an ItemSimpleTag.

    E

    ItemSimpleTag can find the enclosing instance of ShoppingListTag by calling findAncestorWithClass()on the PageContext and casting the result to ShoppingListTag.


    正确答案: E
    解析: 暂无解析

  • 第7题:

    单选题
    Assume the tag handler for a st:simpletag extends SimpleTagSupport. In what way can scriptlet code be used in the body of st:simple?()
    A

     Set the body content type to JSP in the TLD

    B

     Scriptlet code is NOT legal in the body of st:simple

    C

     Add scripting-enabled= “true” to the start tag for the st:simple element

    D

     Add a pass-through Classic tag with a body content type of JSP to the body of st:simple, and      place the scriptlet code in the body of that tag.


    正确答案: A
    解析: 暂无解析

  • 第8题:

    多选题
    class One {  void foo() {}  }  class Two extends One {   //insert method here  }  Which three methods, inserted individually at line 14, will correctly complete class Two?()
    A

    int foo() { /* more code here */ }

    B

    void foo() { /* more code here */ }

    C

    public void foo() { /* more code here */ }

    D

    private void foo() { /* more code here */ }

    E

    protected void foo() { /* more code here */ }


    正确答案: C,D
    解析: 暂无解析

  • 第9题:

    单选题
    The tag handler for n:recurse extends SimpleTagSupport.Assuming an n:recurse tag can either contain an empty body or another n:recurse tag, which strategy allows the tag handler for n:recurse to output the nesting depth of the deepest n:recurse tag?()
    A

     It is impossible to determine the deepest nesting depth because it is impossible for tag handlers that extend SimpleTagSupport to communicate with their parent and child tags

    B

     Create a private non-static attribute in the tag handler class called count of type int initialized to      oIncrement count in the doTag method. If the tag has a body, invoke the fragment for that body. Otherwise, output the value of count

    C

     Start a counter at 1. Call getChildTags(). If it returns null, output the value of the counter.      Otherwise, increment counter and continue from where getChildTags() is called. Skip      processing of the body.

    D

     If the tag has a body, invoke the fragment for that body. Otherwise, start a counter at 1. Call      getParent(). If it returns null, output the value of the counter. Otherwise, increment the counter      and continue from where getParent() is called.


    正确答案: B
    解析: 暂无解析

  • 第10题:

    多选题
    A custom tag is defined to take three attributes. Which two correctly invoke the tag within a JSP page?()
    A

    <prefix:myTag a=foo b=bar c=baz />

    B

    <prefix:myTag attributes={foo,bar,baz} />

    C

    <prefix:myTag jsp:attribute a=foo b=bar c=baz />

    D

    <prefix:myTag><jsp:attribute name=a>foo</jsp:attribute><jsp:attribute name=b>bar</jsp:attribute><jsp:attribute name=c>baz</jsp:attribute>. </prefix:myTag>


    正确答案: C,A
    解析: 暂无解析

  • 第11题:

    单选题
    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?()
    A

    Set the body content type to JSP in the TLD

    B

    Scriptlet code is NOT legal in the body of st:simple.

    C

    Add scripting-enabled=true to the start tag for the st:simple element

    D

    Add a pass-through Classic tag with a body content type of JSP to the body of st:simple, and place the scriptlet code in the body of that tag


    正确答案: C
    解析: 暂无解析

  • 第12题:

    多选题
    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?()
    A

    Object o = pageContext.getAttribute(foo);

    B

    Object o = pageContext.findAttribute(foo);

    C

    Object o = pageContext.getAttribute(foo,PageContext.SESSION_SCOPE);

    D

    HttpSession s = pageContext.getSession();Object o = s.getAttribute(foo);


    正确答案: A,D
    解析: 暂无解析

  • 第13题:

    class One {  void foo() {}  }  class Two extends One {   //insert method here  }  Which three methods, inserted individually at line 14, will correctly complete class Two?()

    • A、 int foo() { /* more code here */ }
    • B、 void foo() { /* more code here */ }
    • C、 public void foo() { /* more code here */ }
    • D、 private void foo() { /* more code here */ }
    • E、 protected void foo() { /* more code here */ }

    正确答案:B,C,E

  • 第14题:

    Assume a tag handler extends TagSupport. Which is used within the tag handler to get an attribute “foo” that is in the application scope?()

    • 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”);

    正确答案:D

  • 第15题:

    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?()

    • A、 public void foo() { }
    • B、 public int foo() { return 3; }
    • C、 public Two foo() { return this; }
    • D、 public One foo() { return this; }
    • E、 public Object foo() { return this; }

    正确答案:C,D

  • 第16题:

    Assume the tag handler for a st:simpletag extends SimpleTagSupport. In what way can scriptlet code be used in the body of st:simple?()

    • A、 Set the body content type to JSP in the TLD
    • B、 Scriptlet code is NOT legal in the body of st:simple
    • C、 Add scripting-enabled= “true” to the start tag for the st:simple element
    • D、 Add a pass-through Classic tag with a body content type of JSP to the body of st:simple, and      place the scriptlet code in the body of that tag.

    正确答案:B

  • 第17题:

    The sl:shoppingList and sl:item tags output a shopping list to the response and are used as follows: 11. 12. 13. 14. 15. The tag handler for sl:shoppingList is ShoppingListTag and the tag handler for sl:item is ItemSimpleTag.ShoppingListTag extends BodyTagSupport and ItemSimpleTag extends SimpleTagSupport.Which is true?()

    • A、ItemSimpleTag can find the enclosing instance of ShoppingListTag by calling getParent() and castingthe result to ShoppingListTag.
    • B、ShoppingListTag can find the child instances of ItemSimpleTag by calling super.getChildren() andcasting each to an ItemSimpleTag.
    • C、It is impossible for ItemSimpleTag and ShoppingListTag to find each other in a tag hierarchy becauseone is a Simple tag and the other is a Classic tag.
    • D、ShoppingListTag can find the child instances of ItemSimpleTag by calling getChildren() on thePageContext and casting each to an ItemSimpleTag.
    • E、ItemSimpleTag can find the enclosing instance of ShoppingListTag by calling findAncestorWithClass()on the PageContext and casting the result to ShoppingListTag.

    正确答案:A

  • 第18题:

    单选题
    Assume a tag handler extends TagSupport. Which is used within the tag handler to get an attribute “foo” that is in the application scope?()
    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”);


    正确答案: C
    解析: 暂无解析

  • 第19题:

    单选题
    Which JSP standard action can be used to import content from a resource called foo.jsp?()
    A

    <jsp:import file=’foo.jsp’ />

    B

    <jsp:import page=’foo.jsp’ />

    C

    <jsp:include page=’foo.jsp’ />

    D

    <jsp:include file=’foo.jsp’ />


    正确答案: D
    解析: 暂无解析

  • 第20题:

    多选题
    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?()
    A

    public void foo() { }

    B

    public int foo() { return 3; }

    C

    public Two foo() { return this; }

    D

    public One foo() { return this; }

    E

    public Object foo() { return this; }


    正确答案: C,D
    解析: 暂无解析

  • 第21题:

    单选题
    Which retrieves the value associated with “foo” from within an HttpServlet?()
    A

     String value = getServletConfig( ).getParameter(“foo”);

    B

     String value = getServletContext( ).getAttribute(“foo”);

    C

     Object value = getServletContext( ).getInitParameter(“foo”);

    D

     String value = getServletContext( ).getInitParameter(“foo”)


    正确答案: D
    解析: 暂无解析

  • 第22题:

    多选题
    Given: 6. 7. 8. and a custom tag handler for foo which extends TagSupport. Which two are true about thetag handler referenced by foo?()
    A

    The doStartTag method is called once.

    B

    The doAfterBody method is NOT called.

    C

    The EVAL_PAGE constant is a valid return value for the doEndTag method.

    D

    The SKIP_PAGE constant is a valid return value for the doStartTag method.

    E

    The EVAL_BODY_BUFFERED constant is a valid return value for the doStartTag method.


    正确答案: C,D
    解析: 暂无解析

  • 第23题:

    单选题
    Given the JSP code: and the Classic tag handler code: 5. public int doStartTag() throws JspException { 6. // insert code here 7. // return int 8. } Assume there are no other "foo" attributes in the web application. Which invocation on the pageContextobject,inserted at line 6,assigns "bar" to the variable x?()
    A

    String x = (String) pageContext.getAttribute(foo)

    B

    String x = (String) pageContext.getRequestScope(foo)

    C

    It is NOT possible to access the pageContext object from within doStartTag

    D

    String x = (String) pageContext.getRequest().getAttribute(foo)

    E

    String x = (String) pageContext.getAttribute(foo, PageContext.ANY_SCOPE)


    正确答案: B
    解析: 暂无解析

  • 第24题:

    多选题
    Given: 6. 7. 8. and a custom tag handler for foo which extends TagSupport. Which two are true about thetag handler referenced by foo?()
    A

    The doStartTag method is called once.

    B

    The doAfterBody method is NOT called.

    C

    The EVAL_PAGE constant is a valid return value for the doEndTag method.

    D

    The SKIP_PAGE constant is a valid return value for the doStartTag method.

    E

    The EVAL_BODY_BUFFERED constant is a valid return value for the doStartTag method.


    正确答案: A,D
    解析: 暂无解析