J2EE中,哪个类的哪个方法用于创建对话?()A、HttpServletRequest、getSessionB、HttpServletResponse、newSessionC、HtttpSession、newInstanceD、HttpSession、getSession

题目

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

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

相似考题
更多“J2EE中,哪个类的哪个方法用于创建对话?()A、HttpServletRequest、getSessionB、HttpServletResponse、newSessionC、HtttpSession、newInstanceD、HttpSession、getSession”相关问题
  • 第1题:

    Servlet的基本架构

    public class ServletName extends HttpServlet {

    public void doPost(HttpServletRequest request, HttpServletResponse response) throws

    ServletException, IOException {

    }

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws

    ServletException, IOException {

    }

    }

    1、用String的方法将数据类型转换为String。


    正确答案:

     

    1、String.valueOf(1.23)

  • 第2题:

    Servlet可以通过以下哪个接口实现请求转发机制?()

    • A、HttpServletRequest接口
    • B、RequestDispatcher接口
    • C、HttpServletResponse接口
    • D、ServletConfig接口
    • E、Filter接口

    正确答案:B

  • 第3题:

    在J2EE中,对于在Servlet如何获得会话,描述正确的是()。     

    • A、HttpServletRequest类的getSession方法有两个:带参数的getSession方法和不带参数的getSession方法
    • B、在Servlet中,可以使用HttpSession session = new HttpSession()创建session对象
    • C、如果HttpServletRequest类的getSession方法的参数为false,表示如果没有与当前的请求相联系的会话对象时,该方法返回null
    • D、如果HttpServletRequest类的getSession方法的参数为true,表示如果没有与当前的请求相联系的会话对象时,该方法返回null

    正确答案:A,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题:

    J2EE中,HttpServletRequest类的()方法用返回与当前请求相关联的会话,如果没有,则返回null。

    • A、getSession(null)
    • B、getSession(true)
    • C、getSession(false)

    正确答案:C

  • 第6题:

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

    • A、 req.getSession()
    • B、 req.getSession(false)
    • C、 req.getSession(true)
    • D、 req.createSession()

    正确答案:A,C

  • 第7题:

    下列哪个类是抽象类()。

    • A、ServletConfig
    • B、HttpServlet
    • C、Cookie
    • D、HttpServletRequest

    正确答案:B

  • 第8题:

    J2EE中()类()方法用于返回应用程序的上下文路径。

    • A、ServletContext、getContextPath()
    • B、HttpServletRequset、getPathInfo()
    • C、HttpServletRequest、getContextPath()
    • D、ServletContext、getPathInfo()

    正确答案:C

  • 第9题:

    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

  • 第10题:

    单选题
    从HTTP请求中,获得请求参数,应该调用哪个方法?()
    A

    调用HttpServletRequest对象的getAttribute()方法

    B

    调用ServletContext对象的getAttribute()方法

    C

    调用HttpServletRequest对象的getParameter()方法


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

  • 第11题:

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

     HttpSession通过HttpServletRequest对象获得

    B

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

    C

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

    D

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


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

  • 第12题:

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

    HttpServletRequest;getSession

    B

    HttpServletRequest;NewSession

    C

    HttpSession;newInstance

    D

    HttpSession;getSession


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

  • 第13题:

    在Java Web开发中,要在服务器端查询cookie,要用到HttpServletRequest的哪个方法?()

    • A、session
    • B、getCookies
    • C、addCookie
    • D、getSession

    正确答案:B

  • 第14题:

    下面哪个方法不是HttpServlet类:()

    • A、protected void doGet(HttpServletRequest reg,HttpServletResponse res) throws Servlet Exception ,java.io.IOException
    • B、protected void doPost(HttpServletRequest reg,HttpServletResponse res) throws Servlet Exception,java.io.IOException
    • C、protected void doHead(HttpServletRequest reg,HttpServletResponse res) throws Servlet Exception,java.io.IOException
    • D、protected void doReceive(HttpServletRequest reg,HttpServletResponse res) throws ServletException,java.io.IOException

    正确答案:D

  • 第15题:

    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

  • 第16题:

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

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

    正确答案:A

  • 第17题:

    HttpServletRequest接口的()方法用于创建会话。

    • A、setSession()
    • B、getContext()
    • C、getSession()
    • D、putSession()

    正确答案:C

  • 第18题:

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

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

    正确答案:C

  • 第19题:

    在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

  • 第20题:

    从HTTP请求中,获得请求参数,应该调用哪个方法?()

    • A、调用HttpServletRequest对象的getAttribute()方法
    • B、调用ServletContext对象的getAttribute()方法
    • C、调用HttpServletRequest对象的getParameter()方法

    正确答案:C

  • 第21题:

    多选题
    在J2EE中,对于在Servlet如何获得会话,描述正确的是()。
    A

    HttpServletRequest类的getSession方法有两个:带参数的getSession方法和不带参数的getSession方法

    B

    在Servlet中,可以使用HttpSession session = new HttpSession()创建session对象

    C

    如果HttpServletRequest类的getSession方法的参数为false,表示如果没有与当前的请求相联系的会话对象时,该方法返回null

    D

    如果HttpServletRequest类的getSession方法的参数为true,表示如果没有与当前的请求相联系的会话对象时,该方法返回null


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

  • 第22题:

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

    HttpServletRequest、getSession

    B

    HttpServletResponse、newSession

    C

    HtttpSession、newInstance

    D

    HttpSession、getSession


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

  • 第23题:

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