request.getCookies()
request.getAttributes()
request.getSession ().getCookies()
request.getSession (). GetAttributes()
第1题:
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}%>
第2题:
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++;%>
第3题:
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?()
第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?()
第5题:
Given a header in an HTTP request:X-Retries:4 Which two retrieve the value of the header from a given HttpServletRequest request?()
第6题:
下面哪句代码能获得硬盘上所有的Cookie?()
第7题:
Given an HttpServletRequest request, which retrieves an object of type Account with an Id of “account”?()
第8题:
Which retrieves all cookies sent in a given HttpSErvletRequest request?()
第9题:
An IllegalStateException is thrown at runtime.
An InvalidSessionException is thrown at runtime.
The string value=null appears in the response stream.
The string value=myAttributeValue appears in the response stream.
第10题:
HttpSession session = request.getSession();
HttpSession session = request.getSession(id);
HttpSession session = request.getSession(true);
HttpSession session = request.getSession(false);
HttpSession session = request.getSession(jsessionid);
第11题:
没有区别
如果当前reqeust中的HttpSession 为null,当传入参数为空时,就创建一个新的Session,否则返回null
如果当前reqeust中的HttpSession 为null,当传入参数为true时,就创建一个新的Session,否则返回null
第12题:
<%! int count = 0; %><% if ( request.getSession(false) == null ) count++; %>
<%@ int count = 0; %>. <% if ( request.getSession(false) == null ) count++; %>
<% int count = 0;. if ( request.getSession(false) == null ) count++; %>
<%@ int count = 0;. if ( request.getSession(false) == null ) count++; %>
<%! int count = 0;. if ( request.getSession(false) == null ) count++; %>
第13题:
A.request.getCookies()
B.request.getAttributes()
C.request.getSession().getCookies()
D.request.getSession().GetAttributes()
第14题:
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?()
第15题:
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?()
第16题:
写入和读取cookie的方法是()
第17题:
如何获取一个Cookie[]?()
第18题:
下列哪种方式可以在session中保存一个名为"name",值为"newer"的属性()
第19题:
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?()
第20题:
Account account = request.get Resource(”account”):
Account account = request.get Attribute (“account”):
Account account = request.get Parameter (account”):
Account account = (Account)request.getResource (“account”):
Account account = (Account) request.get Attribute (“account”):
Account account = (Account) request.get Paramter (“account”):
第21题:
session = response.getSession();
session = request.getSession();
session = request.getSession(true);
session = request.getSession(false);
session = request.getSession(jsessionid);
第22题:
request.getCookies()
request.getAttributes()
request.getSession ().getCookies()
request.getSession (). GetAttributes()
第23题:
request.addCookies()和response.getCookies()
response.addcookie()和request.getCookies()
request.addCookies()和request.getCookies()
response.addcookie()和response.getCookies()
第24题:
Cookie cookie[]=request.getCookies()
Cookie cookie[]=request.addCookies()
response.addCookie(cookie)
Cookie c=new cookie(“name”,“value”)
以上选项都不能