网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
J2EE中,HttpServletRequest类的()方法用返回与当前请求相关联的会话,如果没有,则返回null。
- A、getSession(null)
- B、getSession(true)
- C、getSession(false)
参考答案
更多 “J2EE中,HttpServletRequest类的()方法用返回与当前请求相关联的会话,如果没有,则返回null。A、getSession(null)B、getSession(true)C、getSession(false)” 相关考题
考题
在J2EE中,对于在Servlet如何获得会话,描述正确的是()。
A.HttpServletRequest类的getSession方法有两个:带参数的getSession方法和不带参数的getSession方法B.在Servlet中,可以使用HttpSessionsession=newHttpSession()创建session对象C.如果HttpServletRequest类的getSession方法的参数为false,表示如果没有与当前的请求相联系的会话对象时,该方法返回nullD.如果HttpServletRequest类的getSession方法的参数为true,表示如果没有与当前的请求相联系的会话对象时,该方法返回null
考题
在Servlet里,能正确获取session的语句是()。
A、HttpSessionsession=request.getSession(true)B、HttpSessionsession=request.getHttpSession(true)C、HttpSessionsession=response.getSession(true)D、HttpSessionsession=response.getHttpSession(true)
考题
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);
考题
GivenanHttpServletRequestrequest:22.Stringid=request.getParameter(jsessionid);23.//insertcodehere24.Stringname=(String)session.getAttribute(name);Whichthreecanbeplacedatline23toretrieveanexistingHttpSessionobject?()A.HttpSessionsession=request.getSession();B.HttpSessionsession=request.getSession(id);C.HttpSessionsession=request.getSession(true);D.HttpSessionsession=request.getSession(false);E.HttpSessionsession=request.getSession(jsessionid);
考题
YouarebuildingaFrontControllerusingaJSPpageandyouneedtodetermineiftheuser’ssessionhasNOTbeencreatedyetandperformsomespecialprocessingforthiscase.Whichscriptletcodesnippetwillperformthistest?()
A.%if(request.getSession(false)==null){//specialprocessing}%B.%if(request.getHttpSession(false)==null){//specialprocessing}%C.%if(requestObject.getSession(false)==null){//specialprocessing}%D.%if(requestObject.getHttpSession(false)==null){//specialprocessing}%
考题
Fordebuggingpurposes,youneedtorecordhowmanytimesagivenJSPisinvokedbeforetheuser’ssessionhasbeencreated.TheJSP’sdestroymethodstoresthisinformationtoadatabase.WhichJSPcodesnippetkeepstrackofthiscountforthelifetimeoftheJSPpage?()A.%!intcount=0;%%if(request.getSession(false)==null)count++;%B.%@intcount=0;%.%if(request.getSession(false)==null)count++;%C.%intcount=0;.if(request.getSession(false)==null)count++;%D.%@intcount=0;.if(request.getSession(false)==null)count++;%E.%!intcount=0;.if(request.getSession(false)==null)count++;%
考题
J2EE中,()类型的()方法用于得到会话。
A.HttpServletRequest、getSessionB.HttpServletResponse、newSessionC.HtttpSession、newInstanceD.HttpSession、getSession
考题
在public HttpSession getSession(boolean bool)的方法定义中,当bool为false时表明()A、直接返回会话对象B、当服务器已经创建了会话对象就返回该对象,否则返回nullC、直接返回nullD、当服务器已经创建了会话对象就返回该对象,否则新建一个会话对象并返回
考题
J2EE中,哪个类的哪个方法用于创建对话?()A、HttpServletRequest、getSessionB、HttpServletResponse、newSessionC、HtttpSession、newInstanceD、HttpSession、getSession
考题
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");
考题
For debugging purposes, you need to record how many times a given JSP is invoked before the user’ssession has been created. The JSP’s destroy method stores this information to a database. Which JSPcode snippet keeps track of this count for the lifetime of the JSP page?()A、%! int count = 0; %% if ( request.getSession(false) == null ) count++; %B、%@ int count = 0; %. % if ( request.getSession(false) == null ) count++; %C、% int count = 0;. if ( request.getSession(false) == null ) count++; %D、%@ int count = 0;. if ( request.getSession(false) == null ) count++; %E、%! int count = 0;. if ( request.getSession(false) == null ) count++; %
考题
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");
考题
J2EE中,()类的()方法用于创建对话。A、HttpServletRequest;getSessionB、HttpServletRequest;NewSessionC、HttpSession;newInstanceD、HttpSession;getSession
考题
在Java EE中,如果req是HttpServletRequest的实例,要通过req获取已经存在的HttpSession对象,如果不存在就创建一个HttpSession对象,下面选项中()可以实现。A、 req.getSession()B、 req.getSession(false)C、 req.getSession(true)D、 req.createSession()
考题
HttpSession session=request.getSession(false)与HttpSession session = request.getSession(true)的区别()。A、没有区别B、如果当前reqeust中的HttpSession 为null,当传入参数为空时,就创建一个新的Session,否则返回nullC、如果当前reqeust中的HttpSession 为null,当传入参数为true时,就创建一个新的Session,否则返回null
考题
You are building a Front Controller using a JSP page and you need to determine if the user’s session hasNOT been created yet and perform some special processing for this case. Which scriptlet code snippet willperform this test?()A、% if ( request.getSession(false) == null ) {// special processing} %B、% if ( request.getHttpSession(false) == null ) {// special processing} %C、% if ( requestObject.getSession(false) == null ) { // special processing} %D、% if ( requestObject.getHttpSession(false) == null ) { // special processing} %
考题
Which retrieves all cookies sent in a given HttpSErvletRequest request?()A、 request.getCookies()B、 request.getAttributes()C、 request.getSession ().getCookies()D、 request.getSession (). GetAttributes()
考题
多选题在J2EE中,对于在Servlet如何获得会话,描述正确的是()。AHttpServletRequest类的getSession方法有两个:带参数的getSession方法和不带参数的getSession方法B在Servlet中,可以使用HttpSession session = new HttpSession()创建session对象C如果HttpServletRequest类的getSession方法的参数为false,表示如果没有与当前的请求相联系的会话对象时,该方法返回nullD如果HttpServletRequest类的getSession方法的参数为true,表示如果没有与当前的请求相联系的会话对象时,该方法返回null
考题
单选题J2EE中,哪个类的哪个方法用于创建对话?()A
HttpServletRequest、getSessionB
HttpServletResponse、newSessionC
HtttpSession、newInstanceD
HttpSession、getSession
考题
单选题J2EE中,HttpServletRequest类的()方法用返回与当前请求相关联的会话,如果没有,则返回null。A
getSession(null)B
getSession(true)C
getSession(false)
考题
单选题在public HttpSession getSession(boolean bool)的方法定义中,当bool为false时表明()A
直接返回会话对象B
当服务器已经创建了会话对象就返回该对象,否则返回nullC
直接返回nullD
当服务器已经创建了会话对象就返回该对象,否则新建一个会话对象并返回
考题
多选题在Java EE中,如果req是HttpServletRequest的实例,要通过req获取已经存在的HttpSession对象,如果不存在就创建一个HttpSession对象,下面选项中()可以实现。Areq.getSession()Breq.getSession(false)Creq.getSession(true)Dreq.createSession()
考题
单选题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);
考题
单选题Which retrieves all cookies sent in a given HttpSErvletRequest request?()A
request.getCookies()B
request.getAttributes()C
request.getSession ().getCookies()D
request.getSession (). GetAttributes()
考题
单选题J2EE中,()类的()方法用于创建对话。A
HttpServletRequest;getSessionB
HttpServletRequest;NewSessionC
HttpSession;newInstanceD
HttpSession;getSession
热门标签
最新试卷