网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
Which retrieves all cookies sent in a given HttpSErvletRequest request?()
- A、 request.getCookies()
- B、 request.getAttributes()
- C、 request.getSession ().getCookies()
- D、 request.getSession (). GetAttributes()
参考答案
更多 “Which retrieves all cookies sent in a given HttpSErvletRequest request?()A、 request.getCookies()B、 request.getAttributes()C、 request.getSession ().getCookies()D、 request.getSession (). GetAttributes()” 相关考题
考题
给定某servlet 程序的片段,如下:Public void doGet(HttpServletRequestrequest,Httpservletresponse response){_________}要把session的失效时间设为30分钟,应该在下划线处插入( )A、request.getSession().setTimeout(1800);B、request.getSession().setTimeout(30)C、request.getSession().setMaxInactiveInterval(1800);D、request.getSession().setMaxInactiveInterval(30);
考题
在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}%
考题
WhichretrievesallcookiessentinagivenHttpSErvletRequestrequest?()
A.request.getCookies()B.request.getAttributes()C.request.getSession().getCookies()D.request.getSession().GetAttributes()
考题
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++;%
考题
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 the definition of MyServlet: 11.public class MyServlet extends HttpServlet { 12.public void service(HttpServletRequest request, 13.HttpServletResponse response) 14.throws ServletException, IOException { 15.HttpSession session = request.getSession(); 16.session.setAttribute("myAttribute","myAttributeValue"); 17.session.invalidate(); 18.response.getWriter().println("value=" + 19.session.getAttribute("myAttribute")); 20.} 21.} What is the result when a request is sent to MyServlet?()A、An IllegalStateException is thrown at runtime.B、An InvalidSessionException is thrown at runtime.C、The string "value=null" appears in the response stream.D、The string "value=myAttributeValue" appears in the response stream.
考题
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");
考题
写入和读取cookie的方法是()A、request.addCookies()和response.getCookies()B、response.addcookie()和request.getCookies()C、request.addCookies()和request.getCookies()D、response.addcookie()和response.getCookies()
考题
Given a header in an HTTP request:X-Retries:4 Which two retrieve the value of the header from a given HttpServletRequest request?()A、Request.getHeader("X-Retries")B、Request.getIntHeader("X-Retries")C、Request.getRequestHeader("X-Retries")D、Request.getHeaders("X-Retries").get(0)E、Request.getRequestHeaders("X-Retries").get(0)
考题
如何获取一个Cookie[]?()A、request.getCookies()B、request.getCookie()C、response.getCookies()D、response.getCookie()
考题
下面哪句代码能获得硬盘上所有的Cookie?()A、Cookie cookie[]=request.getCookies()B、Cookie cookie[]=request.addCookies()C、response.addCookie(cookie)D、Cookie c=new cookie(“name”,“value”)E、以上选项都不能
考题
下列哪种方式可以在session中保存一个名为"name",值为"newer"的属性()A、request.getSession().setAttribute(“name”,"newer")B、request.getSession().getAttribute(“ID”,id);C、request.getSession().setParameter(“ID”,id);D、request.getSession().getParameter(“ID”,id)
考题
在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)
考题
Given an HttpServletRequest request, which retrieves an object of type Account with an Id of “account”?()A、 Account account = request.get Resource(”account”):B、 Account account = request.get Attribute (“account”):C、 Account account = request.get Parameter (account”):D、 Account account = (Account)request.getResource (“account”):E、 Account account = (Account) request.get Attribute (“account”):F、 Account account = (Account) request.get Paramter (“account”):
考题
HttpSession session=request.getSession(false)与HttpSession session = request.getSession(true)的区别()。A、没有区别B、如果当前reqeust中的HttpSession 为null,当传入参数为空时,就创建一个新的Session,否则返回nullC、如果当前reqeust中的HttpSession 为null,当传入参数为true时,就创建一个新的Session,否则返回null
考题
Given: 10.public void service(ServletRequest request, 11.ServletResponse response) { 12.ServletInputStream sis = 13.// insert code here 14.} Which retrieves the binary input stream on line 13?()A、request.getWriter();B、request.getReader();C、request.getInputStream();D、request.getResourceAsStream();
考题
单选题Given an HttpServletRequest request, which retrieves an object of type Account with an Id of “account”?()A
Account account = request.get Resource(”account”):B
Account account = request.get Attribute (“account”):C
Account account = request.get Parameter (account”):D
Account account = (Account)request.getResource (“account”):E
Account account = (Account) request.get Attribute (“account”):F
Account account = (Account) request.get Paramter (“account”):
考题
单选题Given the definition of MyServlet: 11.public class MyServlet extends HttpServlet { 12.public void service(HttpServletRequest request, 13.HttpServletResponse response) 14.throws ServletException, IOException { 15.HttpSession session = request.getSession(); 16.session.setAttribute("myAttribute","myAttributeValue"); 17.session.invalidate(); 18.response.getWriter().println("value=" + 19.session.getAttribute("myAttribute")); 20.} 21.} What is the result when a request is sent to MyServlet?()A
An IllegalStateException is thrown at runtime.B
An InvalidSessionException is thrown at runtime.C
The string value=null appears in the response stream.D
The string value=myAttributeValue appears in the response stream.
考题
单选题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()
考题
单选题写入和读取cookie的方法是()A
request.addCookies()和response.getCookies()B
response.addcookie()和request.getCookies()C
request.addCookies()和request.getCookies()D
response.addcookie()和response.getCookies()
考题
单选题下面哪句代码能获得硬盘上所有的Cookie?()A
Cookie cookie[]=request.getCookies()B
Cookie cookie[]=request.addCookies()C
response.addCookie(cookie)D
Cookie c=new cookie(“name”,“value”)E
以上选项都不能
热门标签
最新试卷