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、conte

题目

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”相关问题
  • 第1题:

    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

  • 第2题:

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

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

    正确答案:A

  • 第3题:

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

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

    正确答案:C

  • 第4题:

    下面关于HttpSession的说法正确的是()

    • A、Servlet容器负责创建HttpSession对象
    • B、每个HttpSession对象都有惟一的ID
    • C、HttpSession的数据保存在客户端
    • D、对客户端每次请求服务器都会创建HttpSession对象

    正确答案:A,B

  • 第5题:

    session对象是HttpSession接口类的实例,由客户端负责创建和销毁。


    正确答案:错误

  • 第6题:

    关于HttpSession会话对象的属性,正确的选项是()?

    • A、绑定到HttpSession对象上的属性在应用程序的生存期内总是有效的
    • B、会话属性是特定用户的专用数据,同时访问WEB应用的其他用户无法访问这些属性
    • C、使用HttpSession对象的addAttribute方法添加会话属性
    • D、使用HttpSession对象的removeAttributeNames方法删除会话属性

    正确答案:B

  • 第7题:

    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.

    正确答案:C

  • 第8题:

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


    正确答案: B
    解析: 暂无解析

  • 第9题:

    多选题
    在Java EE中,如果req是HttpServletRequest的实例,要通过req获取已经存在的HttpSession对象,如果不存在就创建一个HttpSession对象,下面选项中()可以实现。
    A

    req.getSession()

    B

    req.getSession(false)

    C

    req.getSession(true)

    D

    req.createSession()


    正确答案: A,C
    解析: 暂无解析

  • 第10题:

    单选题
    A web application uses the HttpSession mechanism to determine if a user is "logged in." When a usersupplies a valid user name and password, an HttpSession is created for that user. The user has access tothe application for only 15 minutes after logging in. The code must determine how long the user has beenlogged in, and if this time is greater than 15 minutes, must destroy the HttpSession. Which method in HttpSession is used to accomplish this?()
    A

    Getcreationtime

    B

    Invalidateafter

    C

    Getlastaccessedtime

    D

    Getmaxinactiveinterval


    正确答案: B
    解析: 暂无解析

  • 第11题:

    多选题
    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,D
    解析: 暂无解析

  • 第12题:

    问答题
    HttpSession与Hibernate中Session的区别

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

  • 第13题:

    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

  • 第14题:

    HttpSession失效的时机是()。

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

    正确答案:A

  • 第15题:

    在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

  • 第16题:

    每个HttpSession对象都有惟一的ID。


    正确答案:正确

  • 第17题:

    JavaWeb应用程序必须负责为HttpSession分配惟一的ID。


    正确答案:错误

  • 第18题:

    HttpSession session=request.getSession(false)与HttpSession session = request.getSession(true)的区别()。

    • A、没有区别
    • B、如果当前reqeust中的HttpSession 为null,当传入参数为空时,就创建一个新的Session,否则返回null
    • C、如果当前reqeust中的HttpSession 为null,当传入参数为true时,就创建一个新的Session,否则返回null

    正确答案:C

  • 第19题:

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

     HttpSession通过HttpServletRequest对象获得

    B

     HttpSession可以用来保存数据,并实现数据的传递

    C

     HttpSession被创建后,将始终存在,直到服务停止

    D

     调用HttpSession的invalidate()方法,可以删除创建的HttpSession对象及数据


    正确答案: B
    解析: 暂无解析

  • 第20题:

    单选题
    关于HttpSession会话对象的属性,正确的选项是()?
    A

    绑定到HttpSession对象上的属性在应用程序的生存期内总是有效的

    B

    会话属性是特定用户的专用数据,同时访问WEB应用的其他用户无法访问这些属性

    C

    使用HttpSession对象的addAttribute方法添加会话属性

    D

    使用HttpSession对象的removeAttributeNames方法删除会话属性


    正确答案: D
    解析: 暂无解析

  • 第21题:

    判断题
    每个HttpSession对象都有惟一的ID。
    A

    B


    正确答案:
    解析: 暂无解析

  • 第22题:

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


    正确答案: A
    解析: 暂无解析

  • 第23题:

    多选题
    下面关于HttpSession的说法正确的是()
    A

    Servlet容器负责创建HttpSession对象

    B

    每个HttpSession对象都有惟一的ID

    C

    HttpSession的数据保存在客户端

    D

    对客户端每次请求服务器都会创建HttpSession对象


    正确答案: A,B
    解析: 暂无解析