单选题Your IT department is building a lightweight Front Controller servlet that invokes an application logic objectwith the interface: public interface ApplicationController {public String invoke(HttpServletRequest request)} The return value of this method 

题目
单选题
Your IT department is building a lightweight Front Controller servlet that invokes an application logic objectwith the interface: public interface ApplicationController {public String invoke(HttpServletRequest request)} The return value of this method indicates a symbolic name of the next view. From this name, the FrontController servlet looks up the JSP URL in a configuration table. This URL might be an absolute path or apath relative to the current request. Next, the Front Controller servlet must send the request to this JSP togenerate the view. Assume that the servlet variable request is assigned the current HttpServletRequestobject and the variable context is assigned the webapp’s ServletContext. Which code snippet of the FrontController servlet accomplishes this goal?()
A

Dispatcher view=context.getDispatcher(viewURL);view.forward Request(request, response);

B

Dispatcher view=request.getDispatcher(viewURL);view.forward Request(request, response);

C

RequestDispatcher view. =context.getRequestDispatcher(viewURL);view.forward(request,response);

D

RequestDispatcher view=request.getRequestDispatcher(viewURL);view.forward(request, response);


相似考题

1.A Windows Communication Foundation (WCF) solution uses the following contracts. (Line numbers are included for reference only.)01 [ServiceContract(CallbackContract=typeof(INameService))]02 public interface IGreetingService03 {04 [OperationContract]05 string GetMessage();06 }07 [ServiceContract]08 public interface INameService09 {10 [OperationContract]11 string GetName();12 }The code that implements the IGreetingService interface is as follows:20 public class GreetingService : IGreetingService21{22 public string GetMessage()23 {24 INameService clientChannel = OperationContext.Current.GetCallbackChannel();25 string clientName = clientChannel.GetName();26 return String.Format("Hello {0}", clientName);27 }28 }The service is self-hosted. The hosting code is as follows:30 ServiceHost host = new ServiceHost(typeof(GreetingService));31 NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);32 host.AddServiceEndpoint("MyApplication.IGreetingService", binding, "net.tcp//localhost:12345");33 host.Open();The code that implements the lNameService interface is as follows:40 class NameService : INameService41 {42 string name;43 public NameService(string name)44 {45 this.name = name;46 }47 public string GetName()48 {49 return name;50 }51 }Currently, this code fails at runtime, and an InvalidOperationException is thrown at line 25. You need to correct the code so that the call from the service back to the client completes successfully. What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)()

更多“单选题Your IT department is building a lightweight Front Controller servlet that invokes an application logic objectwith the interface: public interface ApplicationController {public String invoke(HttpServletRequest request)} The return value of this method ”相关问题
  • 第1题:

    public class Employee{   private String name;   public Employee(String name){   this.name = name;  }   public String getName(){   return name;  }  }   public class Manager extends Employee{   private String department;   public Manager(String name,String department){   this.department = department;   super(name); (应于上一行掉位置)   System.out.println(getName());  }  }   Super的位置是否在方法的首行   执行语句new Manager(“smith”,”SALES”)后程序的输出是哪项?()

    • A、 smith
    • B、 null
    • C、 SALES
    • D、 编译错误

    正确答案:D

  • 第2题:

    Which three demonstrate an “is a” relationship?() 

    • A、 public class X {  }     public class Y extends X { }
    • B、 public interface Shape { }     public interface Rectangle extends Shape{ }
    • C、 public interface Color { }     public class Shape { private Color color; }
    • D、 public interface Species { }     public class Animal { private Species species; }
    • E、 public class Person { }    public class Employee {      public Employee(Person person) { }
    • F、 interface Component { }     class Container implements Component {   private Component[] children; }

    正确答案:A,B,F

  • 第3题:

    public class Employee{       private String name;  public Employee(String name){           this.name = name;      }  public String getName(){         return name;      } }  public class Manager extends Employee{       private String department;  public Manager(String name,String department){          this.department = department;          super(name);  System.out.println(getName());      }  }  执行语句new Manager(“smith”,”SALES”)后程序的输出是哪项?() 

    • A、 smith
    • B、 null
    • C、 SALES
    • D、 编译错误

    正确答案:D

  • 第4题:

    Which the two demonstrate an “is a” relationship?()

    • A、 public interface Person {}  Public class Employee extends Person {}
    • B、 public interface Shape {}  public interface Rectangle extends Shape {}
    • C、 public interface Color {}  public class Shape { private Color color; }
    • D、 public class Species {}  public class Animal { private Species species; }
    • E、 interface Component {} Class Container implements Component {private Component [] children;

    正确答案:B,E

  • 第5题:

    interface Beta {}  class Alpha implements Beta {  String testIt() {  return “Tested”;  }  }  public class Main1 {  static Beta getIt() {  return new Alpha();  }  public static void main( String[] args ) {  Beta b = getIt();  System.out.println( b.testIt() );  }  }  What is the result?()  

    • A、 Tested
    • B、 Compilation fails.
    • C、 The code runs with no output.
    • D、 An exception is thrown at runtime.

    正确答案:B

  • 第6题:

    You are developing a Hotel Booking application for a travel company. The users request a wizard-style interface for this application. How could you satisfy this requirement?()

    • A、Reference the Object Iron packages in your form module. 
    • B、Write an HTML interface, and invoke it from your form module. 
    • C、Include the Wizard class reusable component in your application. 
    • D、Build a customized wizard using tab canvases and a horizontal toolbar canvas.

    正确答案:C

  • 第7题:

    单选题
    public interface A {  String DEFAULT_GREETING = “Hello World”;  public void method1();  }  A programmer wants to create an interface called B that has A as its parent. Which interface declaration is correct?()
    A

     public interface B extends A {}

    B

     public interface B implements A {}

    C

     public interface B instanceOf A {}

    D

     public interface B inheritsFrom A {}


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

  • 第8题:

    单选题
    You are developing a Hotel Booking application for a travel company. The users request a wizard-style interface for this application. How could you satisfy this requirement?()
    A

    Reference the Object Iron packages in your form module. 

    B

    Write an HTML interface, and invoke it from your form module. 

    C

    Include the Wizard class reusable component in your application. 

    D

    Build a customized wizard using tab canvases and a horizontal toolbar canvas.


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

  • 第9题:

    单选题
    interface Beta {}  class Alpha implements Beta {  String testIt() {  return “Tested”;  }  }  public class Main1 {  static Beta getIt() {  return new Alpha();  }  public static void main( String[] args ) {  Beta b = getIt();  System.out.println( b.testIt() );  }  }  What is the result?()
    A

     Tested

    B

     Compilation fails.

    C

     The code runs with no output.

    D

     An exception is thrown at runtime.


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

  • 第10题:

    单选题
    You work as an application developer at Certkiller .com. You have recently created an application that includes the code shown below. public delegate stringGetFileContentsDel (); public string GetFileContents () {  //Process file and return results }  You now need to invoke the GetFileContents method asynchronously.  You have to ensure that the code you use to invoke the GetFileContents method will continue to process other user instructions, and displays the results as soon as the GetFileContents method finishes processing.What should you do?()
    A

    A

    B

    B

    C

    C

    D

    D


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

  • 第11题:

    单选题
    Which is a method of the MouseMotionListener interface?()
    A

     Public void mouseMoved(MouseEvent)

    B

     Public boolean mouseMoved(MouseEvent)

    C

     Public void mouseMoved(MouseMotionEvent)

    D

     Public boolean MouseMoved(MouseMotionEvent)

    E

     Public boolean mouseMoved(MouseMotionEvent)


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

  • 第12题:

    单选题
    You work as an application developer at Certkiller .com. You are currently in the process of creating a class that stores data about Certkiller .com’s customers. Certkiller .com customers are assigned unique identifiers and various characteristics that may include aliases, shipping instructions, and sales comments. These characteristics can change in both size and data type. You start by defining the Customer class as shown below: public class Customer { private int custID; private ArrayList attributes; public int CustomerID { get {return custID;} } public Customer (int CustomerID) { this.custID = CustomerID; this.attributes = new ArrayList (); } public void AddAttribute (object att) {  attributes.Add (att); } } You have to create the FindAttribute method for locating attributes in Customer objects no matter what the data type is.You need to ensure that the FindAttributemethod returns the attribute if found,and you also need to ensure type-safety when returning the attribute.What should you do?()
    A

     Use the following code to declare the FindAttribute method: public T FindAttribute (T att) {//Find attribute and return the value }

    B

     Use the following code to declare the FindAttribute method: public object FindAttribute (object att) {//Find attribute and return the value }

    C

     Use the following code to declare the FindAttribute method: public T FindAttribute  (T att) {//Find attribute and return the value }

    D

     Use the following code to declare the FindAttribute method: public string FindAttribute (string att) {//Find attribute and return the value }


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

  • 第13题:

    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

  • 第14题:

    Your IT department is building a lightweight Front Controller servlet that invokes an application logic objectwith the interface: public interface ApplicationController {public String invoke(HttpServletRequest request)} The return value of this method indicates a symbolic name of the next view. From this name, the FrontController servlet looks up the JSP URL in a configuration table. This URL might be an absolute path or apath relative to the current request. Next, the Front Controller servlet must send the request to this JSP togenerate the view. Assume that the servlet variable request is assigned the current HttpServletRequestobject and the variable context is assigned the webapp’s ServletContext. Which code snippet of the FrontController servlet accomplishes this goal?()

    • A、Dispatcher view=context.getDispatcher(viewURL);view.forward Request(request, response);
    • B、Dispatcher view=request.getDispatcher(viewURL);view.forward Request(request, response);
    • C、RequestDispatcher view. =context.getRequestDispatcher(viewURL);view.forward(request,response);
    • D、RequestDispatcher view=request.getRequestDispatcher(viewURL);view.forward(request, response);

    正确答案:D

  • 第15题:

    Which is a method of the MouseMotionListener interface?()

    • A、 Public void mouseMoved(MouseEvent)
    • B、 Public boolean mouseMoved(MouseEvent)
    • C、 Public void mouseMoved(MouseMotionEvent)
    • D、 Public boolean MouseMoved(MouseMotionEvent)
    • E、 Public boolean mouseMoved(MouseMotionEvent)

    正确答案:A

  • 第16题:

    Which two demonstrate an “is a” relationship?()   

    • A、 public interface Person { }  public class Employee extends Person { }
    • B、 public interface Shape { }  public class Employee extends Shape { }
    • C、 public interface Color { }  public class Employee extends Color { }
    • D、 public class Species { }  public class Animal (private Species species;)
    • E、 interface Component { }  Class Container implements Component ( Private Component[ ] children;  )

    正确答案:D,E

  • 第17题:

    You want to create a filter for your web application and your filter will implement javax.servlet.Filter. Which two statements are true?()

    • A、Your filter class must implement an init method and a destroy method.
    • B、Your filter class must also implement javax.servlet.FilterChain.
    • C、When your filter chains to the next filter, it should pass the same arguments it received in its doFiltermethod.
    • D、The method that your filter invokes on the object it received that implements javax.servlet.FilterChaincan invoke either another filter or a servlet.
    • E、Your filter class must implement a doFilter method that takes, among other things, anHTTPServletRequest object and an HTTPServletResponse object.

    正确答案:A,D

  • 第18题:

    You work as an application developer at Certkiller .com. You are currently in the process of creating a class that stores data about Certkiller .com’s customers. Certkiller .com customers are assigned unique identifiers and various characteristics that may include aliases, shipping instructions, and sales comments. These characteristics can change in both size and data type. You start by defining the Customer class as shown below: public class Customer { private int custID; private ArrayList attributes; public int CustomerID { get {return custID;} } public Customer (int CustomerID) { this.custID = CustomerID; this.attributes = new ArrayList (); } public void AddAttribute (object att) {  attributes.Add (att); } } You have to create the FindAttribute method for locating attributes in Customer objects no matter what the data type is.You need to ensure that the FindAttributemethod returns the attribute if found,and you also need to ensure type-safety when returning the attribute.What should you do?()

    • A、 Use the following code to declare the FindAttribute method: public T FindAttribute (T att) {//Find attribute and return the value }
    • B、 Use the following code to declare the FindAttribute method: public object FindAttribute (object att) {//Find attribute and return the value }
    • C、 Use the following code to declare the FindAttribute method: public T FindAttribute  (T att) {//Find attribute and return the value }
    • D、 Use the following code to declare the FindAttribute method: public string FindAttribute (string att) {//Find attribute and return the value }

    正确答案:C

  • 第19题:

    单选题
    1. interface A { public void aMethod(); }  2. interface B { public void bMethod(); }  3. interface C extends A,B { public void cMethod(); }  4. class D implements B {  5. public void bMethod() { }  6. }  7. class E extends D implements C {  8. public void aMethod() { }  9. public void bMethod() { }  10. public void cMethod() { }  11. }  What is the result?()
    A

     Compilation fails because of an error in line 3.

    B

     Compilation fails because of an error in line 7.

    C

     Compilation fails because of an error in line 9.

    D

     If you define D e = new E(), then e.bMethod() invokes the version of bMethod()defined in Line 5.

    E

     If you define D e = (D)(new E()),then e.bMethod() invokes the version of bMethod() defined in Line 5.

    F

     If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 9.


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

  • 第20题:

    多选题
    You want to create a filter for your web application and your filter will implement javax.servlet.Filter. Which two statements are true?()
    A

    Your filter class must implement an init method and a destroy method.

    B

    Your filter class must also implement javax.servlet.FilterChain.

    C

    When your filter chains to the next filter, it should pass the same arguments it received in its doFiltermethod.

    D

    The method that your filter invokes on the object it received that implements javax.servlet.FilterChaincan invoke either another filter or a servlet.

    E

    Your filter class must implement a doFilter method that takes, among other things, anHTTPServletRequest object and an HTTPServletResponse object.


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

  • 第21题:

    单选题
    public class Employee{       private String name;  public Employee(String name){           this.name = name;      }  public String getName(){         return name;      } }  public class Manager extends Employee{       private String department;  public Manager(String name,String department){          this.department = department;          super(name);  System.out.println(getName());      }  }  执行语句new Manager(“smith”,”SALES”)后程序的输出是哪项?()
    A

     smith

    B

     null

    C

     SALES

    D

     编译错误


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

  • 第22题:

    单选题
    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.


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

  • 第23题:

    单选题
    Your IT department is building a lightweight Front Controller servlet that invokes an application logic objectwith the interface: public interface ApplicationController {public String invoke(HttpServletRequest request)} The return value of this method indicates a symbolic name of the next view. From this name, the FrontController servlet looks up the JSP URL in a configuration table. This URL might be an absolute path or apath relative to the current request. Next, the Front Controller servlet must send the request to this JSP togenerate the view. Assume that the servlet variable request is assigned the current HttpServletRequestobject and the variable context is assigned the webapp’s ServletContext. Which code snippet of the FrontController servlet accomplishes this goal?()
    A

    Dispatcher view=context.getDispatcher(viewURL);view.forward Request(request, response);

    B

    Dispatcher view=request.getDispatcher(viewURL);view.forward Request(request, response);

    C

    RequestDispatcher view. =context.getRequestDispatcher(viewURL);view.forward(request,response);

    D

    RequestDispatcher view=request.getRequestDispatcher(viewURL);view.forward(request, response);


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

  • 第24题:

    单选题
    public class Employee{   private String name;   public Employee(String name){   this.name = name;  }   public String getName(){   return name;  }  }   public class Manager extends Employee{   private String department;   public Manager(String name,String department){   this.department = department;   super(name); (应于上一行掉位置)   System.out.println(getName());  }  }   Super的位置是否在方法的首行   执行语句new Manager(“smith”,”SALES”)后程序的输出是哪项?()
    A

     smith

    B

     null

    C

     SALES

    D

     编译错误


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