Given:11.publicclassMyServletextendsHttpServlet{12.publicvoidservice(HttpServletRequestrequest,13.HttpServletResponseresponse)14.throwsServletException,IOException{15.//insertcodehere16.}17.}andthiselementinthewebapplication’sdeploymentdescriptor:<error-p

题目

Given:11.publicclassMyServletextendsHttpServlet{12.publicvoidservice(HttpServletRequestrequest,13.HttpServletResponseresponse)14.throwsServletException,IOException{15.//insertcodehere16.}17.}andthiselementinthewebapplication’sdeploymentdescriptor:<error-page><error-code>302</error-code><location>/html/error.html</location></error-page>Which,insertedatline15,causesthecontainertoredirectcontroltotheerror.htmlresource?()

A.response.setError(302);

B.response.sendError(302);

C.response.setStatus(302);

D.response.sendRedirect(302);

E.response.sendErrorRedirect(302);


相似考题
更多“Given:11.publicclassMyServletextendsHttpServlet{12.publicvoidservice(HttpServletRequestreq ”相关问题
  • 第1题:

    GiventhedefinitionofMyServlet:11.publicclassMyServletextendsHttpServlet{12.publicvoidservice(HttpServletRequestrequest,13.HttpServletResponseresponse)14.throwsServletException,IOException{15.HttpSessionsession=request.getSession();16.session.setAttribute("myAttribute","myAttributeValue");17.session.invalidate();18.response.getWriter().println("value="+19.session.getAttribute("myAttribute"));20.}21.}WhatistheresultwhenarequestissenttoMyServlet?()

    A.AnIllegalStateExceptionisthrownatruntime.

    B.AnInvalidSessionExceptionisthrownatruntime.

    C.Thestring"value=null"appearsintheresponsestream.

    D.Thestring"value=myAttributeValue"appearsintheresponsestream.


    参考答案:A

  • 第2题:

    He was() from his position as the president of the university.

    A、moved

    B、removed

    C、awarded

    D、given


    参考答案:B

  • 第3题:

    ___ more care, the flowers might have grown much better than now.

    A.Having given

    B.Giving

    C.To give

    D.Given

    答案:D
    解析:
    本题主要考查非谓语动词用法,题目意为“如果之前能多关心一些,这些花很可能会比现在长势好的多。”
      过去分词given+词,表示假设的情况,表示假设的情况,相当于一个条件句“If they had been given...”,非真实条件句,当从句的主语与主句的主语相同时,可以改为非谓语(现在分词或过去分词)的省略形式,但不能用完成时态。本句中主语是花,关怀是人给予花的,所以选择过去分词表示被动语态。
      

  • 第4题:

    Given: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


    参考答案:C

  • 第5题:

    [A] set [B] exact [C] given [D] placed


    正确答案:A