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);
第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.
第2题:
A、moved
B、removed
C、awarded
D、given
第3题:
第4题:
A. any class
B. only the Target class
C. any class in the test package
D. any class that extends Target
第5题:
[A] set [B] exact [C] given [D] placed