多选题Given: 3.class MyServlet extends HttpServlet { 4.public void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException,IOException { 5.// servlet code here ... 26.} 27.} If the DD contains a single security constraint associated w

题目
多选题
Given: 3.class MyServlet extends HttpServlet { 4.public void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException,IOException { 5.// servlet code here ... 26.} 27.} If the DD contains a single security constraint associated with MyServlet and its only  tagsand  tags are:GETPUT Admin Which four requests would be allowed by the container?()
A

A user whose role is Admin can perform a PUT.

B

A user whose role is Admin can perform a GET.

C

A user whose role is Admin can perform a POST.

D

A user whose role is Member can perform a PUT.

E

A user whose role is Member can perform a POST.

F

A user whose role is Member can perform a GET.


相似考题
更多“多选题Given: 3.class MyServlet extends HttpServlet { 4.public void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException,IOException { 5.// servlet code here ... 26.} 27.} If the DD contains a single security constraint associated w”相关问题
  • 第1题:

    在J2EE中,有如下代码在Servlet1.java中。  import javax.servlet.*;  import javax.servlet.http.*;  import java.io.IOException;  import java.io.PrintWriter;  public class Servlet1 extends HttpServlet {    public void init()  throws ServletException {   }  public void service(HttpServletRequest request, HttpServletResponse response)  throws ServletException, IOException {      PrintWriter out = response.getWriter();      out.println("hello!");   } }   假如编译Servlet要具备的环境都已经建立好。现在用完全正确的命令编译该文件,对于以下陈述正确的是()。 

    • A、编译该文件时会提示缺少doGet()或者doPost()方法,编译不能够成功通过
    • B、编译后,把Servlet1.class放在正确位置,在浏览器中查看该Servlet1,会看到输出文字:“hello!”
    • C、编译后,把Servlet1.class放在正确位置,在浏览器中查看该Servlet1,却看不到任何输出的文字
    • D、编译后,把Servlet1.class放在正确位置,在浏览器中查看该Servlet1,却看到产生运行时错误的出错信息

    正确答案:B

  • 第2题:

    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");

    正确答案:B,C,D

  • 第3题:

    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

  • 第4题:

    1. public class A {  2. public void method1() {  3. B b=new B();  4. b.method2();  5. // more code here  6. }  7. }  1. public class B {  2. public void method2() {  3.C c=new C();  4. c.method3();  5. // more code here  6. }  7. }  1. public class C {  2. public void method3() {  3. // more code here  4. }  5. }  Given:  25. try {  26. A a=new A();  27. a.method1();  28. } catch (Exception e) {  29. System.out.print(”an error occurred”);  30. }  Which two are true if a NullPointerException is thrown on line 3 of class C?()

    • A、 The application will crash.
    • B、 The code on line 29 will be executed.
    • C、 The code on line 5 of class A will execute.
    • D、 The code on line 5 of class B will execute.
    • E、 The exception will be propagated back to line 27.

    正确答案:B,E

  • 第5题:

    Given: 11.public class MyServlet extends HttpServlet { 12.public void service(HttpServletRequest request, 13.HttpServletResponse response) 14.throws ServletException, IOException { 15.// insert code here 16.} 17.} and this element in the web application’s deployment descriptor: 302 /html/error.html Which,inserted at line 15,causes the container to redirect control to the error.html resource?()

    • A、response.setError(302);
    • B、response.sendError(302);
    • C、response.setStatus(302);
    • D、response.sendRedirect(302);
    • E、response.sendErrorRedirect(302);

    正确答案:B

  • 第6题:

    Given: 3.class MyServlet extends HttpServlet { 4.public void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException,IOException { 5.// servlet code here ... 26.} 27.} If the DD contains a single security constraint associated with MyServlet and its only  tagsand  tags are:GETPUT Admin Which four requests would be allowed by the container?()

    • A、A user whose role is Admin can perform a PUT.
    • B、A user whose role is Admin can perform a GET.
    • C、A user whose role is Admin can perform a POST.
    • D、A user whose role is Member can perform a PUT.
    • E、A user whose role is Member can perform a POST.
    • F、A user whose role is Member can perform a GET.

    正确答案:A,B,C,E

  • 第7题:

    Given the HttpServlet code:   getServletContext().setAttribute(“foo”, “value”); What is the result?()

    • A、 The attribute foo is placed in the application
    • B、 A ServletContextListener registered for that servlet is notified
    • C、 A ServletAttributeListener registered for that servlet is notified
    • D、 An HttpSessionAttributeListener registered for that servlet is notified

    正确答案:A

  • 第8题:

    多选题
    Given:   10. class One {   11. void foo() { }   12. }   13. class Two extends One {   14. //insert method here   15. }   Which three methods, inserted individually at line 14, will correctly complete class Two?()
    A

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

    B

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

    C

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

    D

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

    E

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


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

  • 第9题:

    多选题
    Given: 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 */ }


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

  • 第10题:

    多选题
    1. public class A {  2. public void method1() {  3. B b=new B();  4. b.method2();  5. // more code here  6. }  7. }  1. public class B {  2. public void method2() {  3.C c=new C();  4. c.method3();  5. // more code here  6. }  7. }  1. public class C {  2. public void method3() {  3. // more code here  4. }  5. }  Given:  25. try {  26. A a=new A();  27. a.method1();  28. } catch (Exception e) {  29. System.out.print(”an error occurred”);  30. }  Which two are true if a NullPointerException is thrown on line 3 of class C?()
    A

    The application will crash.

    B

    The code on line 29 will be executed.

    C

    The code on line 5 of class A will execute.

    D

    The code on line 5 of class B will execute.

    E

    The exception will be propagated back to line 27.


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

  • 第11题:

    单选题
    在J2EE中,有如下代码在Servlet1.java中。  import javax.servlet.*;  import javax.servlet.http.*;  import java.io.IOException;  import java.io.PrintWriter;  public class Servlet1 extends HttpServlet {    public void init()  throws ServletException {   }  public void service(HttpServletRequest request, HttpServletResponse response)  throws ServletException, IOException {      PrintWriter out = response.getWriter();      out.println("hello!");   } }   假如编译Servlet要具备的环境都已经建立好。现在用完全正确的命令编译该文件,对于以下陈述正确的是()。
    A

    编译该文件时会提示缺少doGet()或者doPost()方法,编译不能够成功通过

    B

    编译后,把Servlet1.class放在正确位置,在浏览器中查看该Servlet1,会看到输出文字:“hello!”

    C

    编译后,把Servlet1.class放在正确位置,在浏览器中查看该Servlet1,却看不到任何输出的文字

    D

    编译后,把Servlet1.class放在正确位置,在浏览器中查看该Servlet1,却看到产生运行时错误的出错信息


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

  • 第12题:

    单选题
    Given a Filter class definition with this method: 21.public void doFilter(ServletRequest request, 22.ServletResponse response, 23.FilterChain chain) 24.throws ServletException, IOException { 25.// insert code here 26.} Which should you insert at line 25 to properly invoke the next filter in the chain, or the target servlet if thereare no more filters?()
    A

    chain.forward(request, response);

    B

    chain.doFilter(request, response);

    C

    request.forward(request, response);

    D

    request.doFilter(request, response);


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

  • 第13题:

    在J2EE中,Servlet1的代码如下:  import javax.servlet.*;  import javax.servlet.http.*; import java.io.*;  public class Servlet1 extends HttpServlet {  public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {      response.setContentType("text/html");      PrintWriter out = response.getWriter();      String aa=request.getQueryString();      String bb=request.getMethod();      out.println(aa);  out.println(bb);   } }  把Servlet1.class文件放在Web服务器适合的目录下,在浏览B器地址栏内输入:http://localhost:8080/servlet/Servlet1?name=jb-aptech&phone=12345678,看到的结果是()。 

    • A、name=jb-aptech&phone=12345678 GET
    • B、name=jb-aptech,phone=12345678 GET
    • C、jb-aptech,12345678 POST
    • D、name,phone GET
    • E、2,POST

    正确答案:A

  • 第14题:

    Given the definition of MyServlet: 11.public class MyServlet extends HttpServlet { 12.public void service(HttpServletRequest request, 13.HttpServletResponse response) 14.throws ServletException, IOException { 15.HttpSession session = request.getSession(); 16.session.setAttribute("myAttribute","myAttributeValue"); 17.session.invalidate(); 18.response.getWriter().println("value=" + 19.session.getAttribute("myAttribute")); 20.} 21.} What is the result when a request is sent to MyServlet?()

    • A、An IllegalStateException is thrown at runtime.
    • B、An InvalidSessionException is thrown at runtime.
    • C、The string "value=null" appears in the response stream.
    • D、The string "value=myAttributeValue" appears in the response stream.

    正确答案:A

  • 第15题:

    1. public class Exception Test {  2. class TestException extends Exception {}  3. public void runTest() throws TestException {}  4. public void test() /* Point X */ {  5. runTest();  6. }  7. }  At Point X on line 4, which code is necessary to make the code compile?()  

    • A、 No code is necessary.
    • B、 throws Exception
    • C、 catch ( Exception e )
    • D、 throws RuntimeException
    • E、 catch ( TestException e)

    正确答案:B

  • 第16题:

    在J2EE中,有如下代码在Servlet1.java中  Import  javax.servlet.*;  Import  javax,servlet.http.*;  Import  java.io,IOException;  Import  java.io.PrintWriter;  Public  class Servlet1 extends HttpServlet{  Public void init() throws  ServletException{}  Public void service(HttpServletRequest  request, HttpServletResponse  response) throws ServletException,IOException{  PrintWriter out = reponse.getWriter(); Out.println("hello!"); } }  假如要编  译的环境已都已经搭建好。现在用完全正确的命令编译该文件,对于以下陈述正确的是(); 

    • A、编译文件时会提醒缺少doGet和doPost方法,编译不能成功通过
    • B、编译后,把Servlet.Class放在正确的位置,在浏览器查看该Servlet会看到输出文字:“hello”
    • C、编译后,把Servlet.Class放在正确的位置,在浏览器查看该Servlet却看不到任何文字
    • D、编译后,把Servlet.Class放在正确的位置,在浏览器查看该Servlet会却看到运行时的错误信息

    正确答案:B

  • 第17题:

    Given a Filter class definition with this method: 21.public void doFilter(ServletRequest request, 22.ServletResponse response, 23.FilterChain chain) 24.throws ServletException, IOException { 25.// insert code here26. } Which should you insert at line 25 to properly invoke the next filter in the chain,or the target servlet if thereare no more filters?()

    • A、chain.forward(request, response);
    • B、chain.doFilter(request, response);
    • C、request.forward(request, response);
    • D、request.doFilter(request, response);

    正确答案:B

  • 第18题:

    public class TestA{   public void methodA()  throws IOException{   //……   }   }   public class TestB extends TestA{   public void methodA()  throws EOFException{   //……   }   }   public class TestC extends TestA{   public void methodA()  throws Exception{   //……   }   }   当编译类TestC的时候,结果是哪项?() 

    • A、 正常
    • B、 编译错误
    • C、 运行错误
    • D、 以上都不对

    正确答案:B

  • 第19题:

    Given:   10. class One {   11. void foo() { }   12. }   13. class Two extends One {   14. //insert method here   15. }   Which three methods, inserted individually at line 14, will correctly complete class Two?()

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

    正确答案:A,C,E

  • 第20题:

    单选题
    1. public class Exception Test {  2. class TestException extends Exception {}  3. public void runTest() throws TestException {}  4. public void test() /* Point X */ {  5. runTest();  6. }  7. }  At Point X on line 4, which code is necessary to make the code compile?()
    A

     No code is necessary.

    B

     throws Exception

    C

     catch ( Exception e )

    D

     throws RuntimeException

    E

     catch ( TestException e)


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

  • 第21题:

    单选题
    Given: 1.package test; 2. 3.class Target { 4.public String name = "hello";5.} What can directly access and change the value of the variable name?()
    A

    any class

    B

    only the Target class

    C

    any class in the test package

    D

    any class that extends Target


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

  • 第22题:

    多选题
    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
    解析: 暂无解析

  • 第23题:

    多选题
    Given: 3.class MyServlet extends HttpServlet { 4.public void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException,IOException { 5.// servlet code here ... 26.} 27.} If the DD contains a single security constraint associated with MyServlet and its only  tagsand  tags are:GETPUT Admin Which four requests would be allowed by the container?()
    A

    A user whose role is Admin can perform a PUT.

    B

    A user whose role is Admin can perform a GET.

    C

    A user whose role is Admin can perform a POST.

    D

    A user whose role is Member can perform a PUT.

    E

    A user whose role is Member can perform a POST.

    F

    A user whose role is Member can perform a GET.


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

  • 第24题:

    多选题
    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
    解析: 暂无解析