Given an HttpSession

题目

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

对于每个要求访问maillogin.jsp的HTTP请求,Servlet容器都会创建一个HttpSession对象。


正确答案:错误

第2题:

Given: 3.public class MyTagHandler extends TagSupport { 4.public int doStartTag() { 5.// insert code here 6.// return an int 7.} 8.// more code here ... 18.} There is a single attribute foo in the session scope. Which three code fragments,inserted independently atline 5,return the value of the attribute?()

  • A、Object o = pageContext.getAttribute("foo");
  • B、Object o = pageContext.findAttribute("foo");
  • C、Object o = pageContext.getAttribute("foo",PageContext.SESSION_SCOPE);
  • D、HttpSession s = pageContext.getSession();Object o = s.getAttribute("foo");

正确答案:B,C,D

第3题:

Servlet2.4以后提供了哪几种对象的事件监听?()

  • A、ServletContext监听Servlet的会话信息
  • B、ServletContext监听Web上下文的信息
  • C、HttpSession监听Servlet的会话信息
  • D、ServletRequest监听Servlet的请求信息
  • E、HttpSession监听Web上下文的信息

正确答案:B,C,D

第4题:

下列选项中关于HttpSession描述错误的是()。

  • A、 HttpSession通过HttpServletRequest对象获得
  • B、 HttpSession可以用来保存数据,并实现数据的传递
  • C、 HttpSession被创建后,将始终存在,直到服务停止
  • D、 调用HttpSession的invalidate()方法,可以删除创建的HttpSession对象及数据

正确答案:C

第5题:

J2EE中,()类的()方法用于创建对话。

  • A、HttpServletRequest;getSession
  • B、HttpServletRequest;NewSession
  • C、HttpSession;newInstance
  • D、HttpSession;getSession

正确答案:A

第6题:

HttpSession与Hibernate中Session的区别


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

第7题:

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

第8题:

J2EE中,哪个类的哪个方法用于创建对话?()

  • A、HttpServletRequest、getSession
  • B、HttpServletResponse、newSession
  • C、HtttpSession、newInstance
  • D、HttpSession、getSession

正确答案:A

第9题:

HttpSession失效的时机是()。

  • A、执行invaliate()方法
  • B、关闭浏览器
  • C、存活时间超过setMaxInactiveInterval()方法设定的时间

正确答案:A

第10题:

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

正确答案:A

更多相关问题