Given an HttpSession session,a ServletRequest request,and a 

题目
单选题
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)

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

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");


参考答案:D

第2题:

下列操作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);

正确答案:B,E

第3题:

Jsp内嵌对象session的类型为javax.servlet.http.HttpSession,下述语句会使该对象失效的是()

A.session.dispose()

B.session.clear()

C.session.invalidate()

D.session.removeAll()


参考答案:C

第4题:

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");

正确答案:A,C,D

第5题:

HttpSession与Hibernate中Session的区别


正确答案: 1. javax.servlet.http.HttpSession是一个抽象接口
用途:存放这个用户的一些经常被用到的信息,例如:用户名,权限等
2. 它是hibernate操作数据库的一个句柄对象 手动或者通过业务层获取

第6题:

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);

正确答案:B

第7题:

如果不希望JSP网页支持Session,应该如何办?()

  • A、调用HttpSession的invalidate()方法
  • B、〈%@ page session="false" /〉
  • C、〈%@ page session 〉
  • D、〈jsp:useBean id= "user" class= "UserData" scope= "session" /〉

正确答案:B

第8题:

在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”);


正确答案:CD

第9题:

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");

正确答案:D

第10题:

在jsp中作用域由小到大的组合是()

  • A、request page session application
  • B、page request session application
  • C、pageContext request session application
  • D、pageScope request sessionScope applicationScope

正确答案:C

更多相关问题