网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

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.


参考答案

更多 “ 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.Thestringvalue=nullappearsintheresponsestream.D.Thestringvalue=myAttributeValueappearsintheresponsestream. ” 相关考题
考题 Given:11.publicclassMyServletextendsHttpServlet{12.publicvoidservice(HttpServletRequestrequest,13.HttpServletResponseresponse)14.throwsServletException,IOException{15.//insertcodehere16.}17.}andthiselementinthewebapplication’sdeploymentdescriptor:error-pageerror-code302/error-codelocation/html/error.html/location/error-pageWhich,insertedatline15,causesthecontainertoredirectcontroltotheerror.htmlresource?()A.response.setError(302);B.response.sendError(302);C.response.setStatus(302);D.response.sendRedirect(302);E.response.sendErrorRedirect(302);