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

题目内容 (请给出正确答案)
单选题
Given an HttpSession session,a ServletRequest request,and a ServletContext context,which retrieves aURL to /WEB-INF/myconfig.xml within a web application?()
A

session.getResource(/WEB-INF/myconfig.xml)

B

request.getResource(/WEB-INF/myconfig.xml)

C

context.getResource(/WEB-INF/myconfig.xml)

D

getClass().getResource(/WEB-INF/myconfig.xml)


参考答案

参考解析
解析: 暂无解析
更多 “单选题Given an HttpSession session,a ServletRequest request,and a ServletContext context,which retrieves aURL to /WEB-INF/myconfig.xml within a web application?()A session.getResource(/WEB-INF/myconfig.xml)B request.getResource(/WEB-INF/myconfig.xml)C context.getResource(/WEB-INF/myconfig.xml)D getClass().getResource(/WEB-INF/myconfig.xml)” 相关考题
考题 Jsp内嵌对象session的类型为javax.servlet.http.HttpSession,下述语句会使该对象失效的是() A.session.dispose()B.session.clear()C.session.invalidate()D.session.removeAll()

考题 在jsp页面声明中定义了一个方法,下列( )代码不能放入该方法中public void test(HttpServletReqeust request){}A、HttpSession session =request.getSession();B、String name=(String)request.getAttribute("name");C、String name=(String)session.getAttibute("name");D、request.sendRedirect(“index.jsp”);

考题 GivenanHttpServletRequestrequestandanHttpServletResponseresponse:41.HttpSessionsession=null;42.//insertcodehere43.if(session==null){44.//dosomethingifsessiondoesnotexist45.}else{46.//dosomethingifsessionexists47.}Toimplementthedesignintent,whichstatementmustbeinsertedatline42?()A.session=response.getSession();B.session=request.getSession();C.session=request.getSession(true);D.session=request.getSession(false);E.session=request.getSession(jsessionid);

考题 Given a Filter class definition with this method: 21.public void doFilter(ServletRequest request, 22.ServletResponse response, 23.FilterChain chain) 24.throws ServletException, IOException { 25.// insert code here 26.} Which should you insert at line 25 to properly invoke the next filter in the chain, or the target servlet if thereare no more filters?()A、chain.forward(request, response);B、chain.doFilter(request, response);C、request.forward(request, response);D、request.doFilter(request, response);

考题 下列操作Session时,代码错误的是()A、HttpSession session=request.getSession(true);B、Session session=new Session();C、session.setAttribute("username","admin");D、String username=(String)session.getAttribute("username");E、response.add Session(Session);

考题 如果不希望JSP网页支持Session,应该如何办?()A、调用HttpSession的invalidate()方法B、〈%@ page session="false" /〉C、〈%@ page session 〉D、〈jsp:useBean id= "user" class= "UserData" scope= "session" /〉

考题 HttpSession与Hibernate中Session的区别

考题 Given an HttpServletRequest request and an HttpServletResponse response: 41.HttpSession session = null; 42.// insert code here 43.if(session == null) { 44.// do something if session does not exist 45.} else { 46.// do something if session exists47. } To implement the design intent,which statement must be inserted at line 42?()A、session = response.getSession();B、session = request.getSession();C、session = request.getSession(true);D、session = request.getSession(false);E、session = request.getSession("jsessionid");

考题 Given an HttpServletRequest request: 22.String id = request.getParameter("jsessionid"); 23.// insert code here 24.String name = (String) session.getAttribute("name"); Which three can be placed at line 23 to retrieve anexisting HttpSession object?()A、HttpSession session = request.getSession();B、HttpSession session = request.getSession(id);C、HttpSession session = request.getSession(true);D、HttpSession session = request.getSession(false);E、HttpSession session = request.getSession("jsessionid");

考题 在jsp中作用域由小到大的组合是()A、request page session applicationB、page request session applicationC、pageContext request session applicationD、pageScope request sessionScope applicationScope

考题 在Servlet里,能正确获取session的语句是()。A、HttpSession session=request.getSession(true)B、HttpSession session=request.getHttpSession(true)C、HttpSession session=response.getSession(true)D、HttpSession session=response.getHttpSession(true)

考题 在JSP页面中,保存数据的范围由小到大依次是()。A、pageContext,request,application,sessionB、pageContext,application,session,requestC、pageContext,request,session,applicationD、pageContext,session,request,application

考题 HttpSession session=request.getSession(false)与HttpSession session = request.getSession(true)的区别()。A、没有区别B、如果当前reqeust中的HttpSession 为null,当传入参数为空时,就创建一个新的Session,否则返回nullC、如果当前reqeust中的HttpSession 为null,当传入参数为true时,就创建一个新的Session,否则返回null

考题 Given: 10.public void service(ServletRequest request, 11.ServletResponse response) { 12.ServletInputStream sis = 13.// insert code here 14.} Which retrieves the binary input stream on line 13?()A、request.getWriter();B、request.getReader();C、request.getInputStream();D、request.getResourceAsStream();

考题 Given an HttpSession session,a ServletRequest request,and a ServletContext context,which retrieves aURL to /WEB-INF/myconfig.xml within a web application?()A、session.getResource("/WEB-INF/myconfig.xml")B、request.getResource("/WEB-INF/myconfig.xml")C、context.getResource("/WEB-INF/myconfig.xml")D、getClass().getResource("/WEB-INF/myconfig.xml")

考题 Given that session is a valid HttpSession object:   Int max = session.getAttribute(“MyReallyLongName”);   Which is true?()  A、 The value returned needs to be cast to an int.B、 The getAttribute methos takes two arguments.C、 Primitive CANNOT be stored in the HttpSession.D、 The HttpSession attribute name must NOT exceed eight characters.

考题 Given a header in an HTTP request: X-Retries:4  Which two retrieve the value of the header from a given ServletRequest request? ()A、 request.getHeader (“X-Retries”)B、 request.getIntHeader (“X-Retries”)C、 request.getRequestHeader (“x-Retries”)D、 request.getHeaders (“X-Retries”).get (0)E、 re request.getRequest Headers (“X-Retries”). Get (0)

考题 单选题Given an Http Session session. A Servlet Request request. And a Servlet Context context. Which retrieves a URL to /WEB INF/ my config.xml within a web application?()A  session.get Resource (“/WEB-INF/myconfig.xml”)B  request.get Resource (“/WEB-INF/myconfig.xml”)C  context.get Resource (“/WEB-INF/myconfig.xml”)D  get Class ().get Resource (“/WEB-INF/myconfig.xml”)

考题 单选题Given that session is a valid HttpSession object:   Int max = session.getAttribute(“MyReallyLongName”);   Which is true?()A  The value returned needs to be cast to an int.B  The getAttribute methos takes two arguments.C  Primitive CANNOT be stored in the HttpSession.D  The HttpSession attribute name must NOT exceed eight characters.

考题 单选题Given: 10.public void service(ServletRequest request, 11.ServletResponse response) { 12.ServletInputStream sis = 13.// insert code here 14.} Which retrieves the binary input stream on line 13?()A request.getWriter();B request.getReader();C request.getInputStream();D request.getResourceAsStream();

考题 多选题Given a header in an HTTP request: X-Retries:4  Which two retrieve the value of the header from a given ServletRequest request? ()Arequest.getHeader (“X-Retries”)Brequest.getIntHeader (“X-Retries”)Crequest.getRequestHeader (“x-Retries”)Drequest.getHeaders (“X-Retries”).get (0)Ere request.getRequest Headers (“X-Retries”). Get (0)

考题 单选题在jsp中作用域由小到大的组合是()A request page session applicationB page request session applicationC pageContext request session applicationD pageScope request sessionScope applicationScope

考题 单选题Given a Filter class definition with this method: 21.public void doFilter(ServletRequest request, 22.ServletResponse response, 23.FilterChain chain) 24.throws ServletException, IOException { 25.// insert code here26. } Which should you insert at line 25 to properly invoke the next filter in the chain,or the target servlet if thereare no more filters?()A chain.forward(request, response);B chain.doFilter(request, response);C request.forward(request, response);D request.doFilter(request, response);

考题 单选题Given an HttpServletRequest request and an HttpServletResponse response: 41.HttpSession session = null; 42.// insert code here 43.if(session == null) { 44.// do something if session does not exist 45.} else { 46.// do something if session exists47. } To implement the design intent,which statement must be inserted at line 42?()A session = response.getSession();B session = request.getSession();C session = request.getSession(true);D session = request.getSession(false);E session = request.getSession(jsessionid);

考题 多选题Given an HttpServletRequest request: 22.String id = request.getParameter("jsessionid"); 23.// insert code here 24.String name = (String) session.getAttribute("name"); Which three can be placed at line 23 to retrieve anexisting HttpSession object?()AHttpSession session = request.getSession();BHttpSession session = request.getSession(id);CHttpSession session = request.getSession(true);DHttpSession session = request.getSession(false);EHttpSession session = request.getSession(jsessionid);

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

考题 问答题HttpSession与Hibernate中Session的区别