单选题Servlet A receives a request that it forwards to servlet B within another web application in the same webcontainer. Servlet A needs to share data with servlet B and that data must not be visible to other servlets inA’s web application. In which object 

题目
单选题
Servlet A receives a request that it forwards to servlet B within another web application in the same webcontainer. Servlet A needs to share data with servlet B and that data must not be visible to other servlets inA’s web application. In which object can the data that A shares with B be stored?()
A

HttpSession

B

ServletConfig

C

ServletContext

D

HttpServletRequest

E

HttpServletResponse


相似考题
更多“Servlet A receives a request that it forwards to servlet B w”相关问题
  • 第1题:

    在servlet中实现转发功能是通过()方法实现的。

    A.response.getRequestDispatcher()

    B.response.sendRedirect()

    C.request..getRequestDispatcher()

    D.request.sendRedirect()


    参考答案:C

  • 第2题:

    Which two prevent a servlet from handling requests.?()

    • A、 The servlet’s init method returns a non-zero status.
    • B、 The servlet’s init method throws a Servlet Exception
    • C、 The servlet’s init method sets the Servlet Response’s context length to 0
    • D、 The servlet’s init method sets the Servlet Response’s content type to null.
    • E、 The servlet’s init method does NOT return within a time period defined by the servlet container.

    正确答案:B,E

  • 第3题:

    Your web application uses a simple architecture in which servlets handle requests and then forward to aJSP using a request dispatcher. You need to pass information calculated by the servlet to the JSP;furthermore, that JSP uses a custom tag and must also process this information. This information mustNOT be accessible to any other servlet, JSP or session in the webapp. How can you accomplish this goal?()

    • A、Store the data in a public instance variable in the servlet.
    • B、Add an attribute to the request object before using the request dispatcher.
    • C、Add an attribute to the context object before using the request dispatcher.
    • D、This CANNOT be done as the tag handler has no means to extract this data.

    正确答案:B

  • 第4题:

    Servlet可通过由容器传递来的Http Servlet Request对象的()方法来获取客户请求的输入参数。

    • A、getParameter
    • B、getProtocol
    • C、getContentType
    • D、getAttribute

    正确答案:A

  • 第5题:

    Which is the true choice about the web container request processing model()?

    • A、 The init method on a filter is called the first time a servlet mapped to that filter is invoked
    • B、 A filter defined for a servlet must always forward control to the next resource in the filter chain.
    • C、 Filters associated with a named servlet are applied in the order they appear in the web application deployment descriptor file
    • D、 If the init method on a filter throws an UnavailableException, then the container will make no further attempt to execute it

    正确答案:C

  • 第6题:

    A developer has created a special servlet that is responsible for generating XML content that is sent to adata warehousing subsystem. This subsystem uses HTTP to request these large data files, which are compressed by the servlet to save internal network bandwidth. The developer has received a request frommanagement to create several more of these data warehousing servlets. The developer is about to copyand paste the compression code into each new servlet. Which design pattern can consolidate thiscompression code to be used by all of the data warehousing servlets?()

    • A、Facade
    • B、View Helper
    • C、Transfer Object
    • D、Intercepting Filter
    • E、Composite Facade

    正确答案:D

  • 第7题:

    单选题
    Given an HttpServlet Request request and Http Servlet Response response, which sets a cookie “username” with the value “joe” in a servlet.?()
    A

     request.add Cookie (“username”. “joe”)

    B

     request.set Cookie (“username, “joe”)

    C

     response.add Cookie (username”, “joe”))

    D

     request.add Header (new Cookie (“username”, “joe”))

    E

     request.add Cookie (new Cookie (“username”, “joe”))

    F

     response.add Cookie (new Cookie (“username”, “joe”))

    G

     response.add Header (new Cookie (“username”, “joe”))


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

  • 第8题:

    单选题
    A developer has created a special servlet that is responsible for generating XML content that is sent to adata warehousing subsystem. This subsystem uses HTTP to request these large data files, which are compressed by the servlet to save internal network bandwidth. The developer has received a request frommanagement to create several more of these data warehousing servlets. The developer is about to copyand paste the compression code into each new servlet. Which design pattern can consolidate thiscompression code to be used by all of the data warehousing servlets?()
    A

    Facade

    B

    View Helper

    C

    Transfer Object

    D

    Intercepting Filter

    E

    Composite Facade


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

  • 第9题:

    单选题
    Servlet A receives a request that it forwards to servlet B within another web application in the same webcontainer. Servlet A needs to share data with servlet B and that data must not be visible to other servlets inA’s web application. In which object can the data that A shares with B be stored?()
    A

    HttpSession

    B

    ServletConfig

    C

    ServletContext

    D

    HttpServletRequest

    E

    HttpServletResponse


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

  • 第10题:

    单选题
    Servlet A forwarded a request to servlet B using the forward method of RequestDispatcher. What attributein B’s request object contains the URI of the original request received by servlet A?()
    A

    REQUEST_URI

    B

    javax.servlet.forward.request_uri

    C

    javax.servlet.forward.REQUEST_URI

    D

    javax.servlet.request_dispatcher.request_uri

    E

    javax.servlet.request_dispatcher.REQUEST_URI


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

  • 第11题:

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

  • 第12题:

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


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

  • 第13题:

    当属性scope的值为application时,JSP动作定义的JavaBean实例就会被存储到()对象中。

    • A、Servlet Context
    • B、Http Session
    • C、Servlet Application
    • D、Http Servlet Request

    正确答案:A

  • 第14题:

    Servlet A forwarded a request to servlet B using the forward method of RequestDispatcher. What attributein B’s request object contains the URI of the original request received by servlet A?()

    • A、REQUEST_URI
    • B、javax.servlet.forward.request_uri
    • C、javax.servlet.forward.REQUEST_URI
    • D、javax.servlet.request_dispatcher.request_uri
    • E、javax.servlet.request_dispatcher.REQUEST_URI

    正确答案:B

  • 第15题:

    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

  • 第16题:

    Servlet的事件驱动由()实现。

    • A、Filter
    • B、Listener
    • C、Response
    • D、Request

    正确答案:B

  • 第17题:

    A session-scoped attribute is stored by a servlet, and then that servlet forwards to a JSP page. Which threejsp:useBean attributes must be used to access this attribute in the JSP page?()

    • A、id
    • B、name
    • C、bean
    • D、type
    • E、scope

    正确答案:A,D,E

  • 第18题:

    Which is true about the web container request processing model?()

    • A、The init method on a filter is called the first time a servlet mapped to that filter is invoked.
    • B、A filter defined for a servlet must always forward control to the next resource in the filter chain.
    • C、Filters associated with a named servlet are applied in the order they appear in the web application deployment descriptor file.
    • D、If the init method on a filter throws an UnavailableException, then the container will make no further attempt to execute it.

    正确答案:C

  • 第19题:

    多选题
    A session-scoped attribute is stored by a servlet, and then that servlet forwards to a JSP page. Which threejsp:useBean attributes must be used to access this attribute in the JSP page?()
    A

    id

    B

    name

    C

    bean

    D

    type

    E

    scope


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

  • 第20题:

    单选题
    Which retrieves the binary input stream on line 13?()
    A

     request.get Writer ():

    B

     request.get Reader ():

    C

     request.get Input Stream():

    D

     request.get Resource As Stream():

    E

     request.get Resource As Stream (Servlet Request. REQUEST):


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

  • 第21题:

    多选题
    在J2EE中,对于自己编写的Servlet1,以下对Servlet1的定义正确的是()。
    A

    class Servlet1 implements javax.servlet.Servlet

    B

    class Servlet1 extends javax.servlet.GenericServlet

    C

    class Servlet1 extends javax.servlet.http.HttpServlet

    D

    class Servlet1 extends javax.servlet.ServletRequest


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

  • 第22题:

    单选题
    在J2EE中,在Servlet1中的doGet和doPost方法中只有如下代码:  request.setAttribute("jb","aptech");  response.sendRedirect("http://localhost:8080/servlet/Servlet2");  那么在Servlet2中使用()可以把属性jb的值取出来。
    A

    String str=request.getAttribute(jb);

    B

    String str=(String)request.getAttribute(jb);

    C

    Object str=request.getAttribute(jb);

    D

    取不出来


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

  • 第23题:

    单选题
    Servlet A receives a request that it forwards to servlet B within another web application in the same web container. Servlet A needs to share data with servlet B and that data must not be visible to other servlets in A’s web application.  In which object can the data that A shares with B be stored?()
    A

     HttpSession

    B

     ServletConfig

    C

     ServletContext

    D

     HttpServletRequest

    E

     HttpServletResponse


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

  • 第24题:

    单选题
    Your web application uses a simple architecture in which servlets handle requests and then forward to aJSP using a request dispatcher. You need to pass information calculated by the servlet to the JSP;furthermore, that JSP uses a custom tag and must also process this information. This information mustNOT be accessible to any other servlet, JSP or session in the webapp. How can you accomplish this goal?()
    A

    Store the data in a public instance variable in the servlet.

    B

    Add an attribute to the request object before using the request dispatcher.

    C

    Add an attribute to the context object before using the request dispatcher.

    D

    This CANNOT be done as the tag handler has no means to extract this data.


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