Given a Filter class definition with this method: 21.public 

题目
单选题
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);

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

Which two statements are true about the hashCode method?()

  • A、 The hashCode method for a given class can be used to test for object equality and object inequality for that class.
  • B、 The hashCode method is used by the java.util.SortedSet collection class to order theelements within that set.
  • C、 The hashCode method for a given class can be used to test for object inequality, but NOT object equality, for that class.
  • D、 The only important characteristic of the values returned by a hashCode method is that the distribution of values must follow a Gaussian distribution.
  • E、 The hashCode method is used by the java.util.HashSet collection class to group the elements within that set into hash buckets for swift retrieval.

正确答案:C,E

第2题:

Given the web application deployment descriptor elements: 11. 12.ParamAdder 13.com.example.ParamAdder 14.... 24. 25.ParamAdder 26.MyServlet 27. 28. Which element, inserted at line 27,causes the ParamAdder filter to be applied when MyServlet is invokedby another servlet using the RequestDispatcher.include method?()

  • A、<include/>
  • B、<dispatcher>INCLUDE</dispatcher>
  • C、<dispatcher>include</dispatcher>
  • D、<filter-condition>INCLUDE</filter-condition>
  • E、<filter-condition>include</filter-condition>

正确答案:B

第3题:

public class Test{2.int x=12;3.public void method(intx){4.x+=x;5.System.out.println(x);6.}7.}Given:34.Test t=new Test();35.t.method(5);What is the output from line 5 of the Test class?()

A.5

B.10

C.12

D.17

E.24


参考答案:B

第4题:

Given an ActionEvent, which method allows you to identify the affected Component?()  

  • A、 Public class getClass()
  • B、 Public Object getSource()
  • C、 Public Component getSource()
  • D、 Public Component getTarget()
  • E、 Public Component getComponent()
  • F、 Public Component getTargetComponent()

正确答案:B

第5题:

Which methods from the String and StringBuffer classes modify the object on which they are called?()  

  • A、The charAt() method of the String class.
  • B、The toUpperCase() method of the String class.
  • C、The replace() method of the String class.
  • D、The reverse() method of the StringBuffer class.
  • E、The length() method of the StringBuffer class.

正确答案:D

第6题:

1. public class a {  2. public void method1() {  3. try {  4. B b=new b();  5. b.method2();  6. // more code here  7. } catch (TestException te) {  8. throw new RuntimeException(te);  9. }  10. }  11. }  1. public class b {  2. public void method2() throws TestException {  3. // more code here  4. }  5. }  1. public class TestException extends Exception {  2. }  Given:  31. public void method() {  32. A a=new a();  33. a.method1();  34. }  Which is true if a TestException is thrown on line 3 of class b?()

  • A、 Line 33 must be called within a try block.
  • B、 The exception thrown by method1 in class a is not required to be caught.
  • C、 The method declared on line 31 must be declared to throw a RuntimeException.
  • D、 On line 5 of class a, the call to method2 of class b does not need to be placed in a try/catch block.

正确答案:B

第7题:

Given the following interface definition, which definitions are valid?()   interface I {   void setValue(int val);   int getValue();   }    DEFINITION a:   (a) class a extends I {  int value;   void setValue(int val) { value = val;  }   int getValue() {  return value;  }   }   DEFINITION b:   (b) interface b extends I {   void increment();   }   DEFINITION c:   (c) abstract class c implements I {   int getValue() {  return 0;  }  abstract void increment();   }   DEFINITION d:   (d) interface d implements I {  void increment();  }   DEFINITION e:   (e) class e implements I {  int value;   public void setValue(int val) { value = val; }  }  

  • A、Definition a.
  • B、Definition b.
  • C、Definition c.
  • D、Definition d.
  • E、Definition e.

正确答案:B,C

第8题:

Click the Exhibit button. Given:Which statement is true if a TestException is thrown on line 3 of class B? ()

A.Line 33 must be called within a try block.

B.The exception thrown by method1 in class A is not required to be caught.

C.The method declared on line 31 must be declared to throw a RuntimeException.

D.On line 5 of class A, the call to method2 of class B does not need to be placed in a try/catch block.


参考答案:B

第9题:

Given a class whose instances, when found in a collection of objects, are sorted by using the compareTo() method, which two statements are true?()

  • A、The class implements java.lang.Comparable.
  • B、The class implements java.util.Comparator.
  • C、The interface used to implement sorting allows this class to define only one sort sequence.
  • D、The interface used to implement sorting allows this class to define many different sort sequences.

正确答案:A,C

第10题:

Which three are true about servlet filters?()

  • A、A filter must implement the destroy method.
  • B、A filter must implement the doFilter method.
  • C、A servlet may have multiple filters associated with it.
  • D、A servlet that is to have a filter applied to it must implement the javax.servlet.FilterChain interface.
  • E、A filter that is part of a filter chain passes control to the next filter in the chain by invoking the FilterChain.forward method.

正确答案:A,B,C

更多相关问题