单项选择题

A web application uses the HttpSession mechanism to determine if a user is “logged in”. When a user supplies a valid user name and password, an HttpSession is created for that user. 
The user has access to the application for only 15 minutes after logging in. The code must determine how long the user has been logged 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


您可能感兴趣的试卷

你可能感兴趣的试题

1.多项选择题Which two classes or interfaces provide a getSession method?()

A. javax.servlet.http.HttpServletRequest
B. javax.servlet.http.HttpSessionContext
C. javax.servlet.http.HttpsServletResponse
D. javax.servlet.http.HttpSessionBindingEvent
E. javax.servlet.http.HttpSessionAttributeEvent

2.多项选择题Which the three interfaces need to be declared in the web application deployment descriptor? ()

A. HttpSessionListener
B. HttpSessionBindingListener
C. HttpSessionTimedOutListener
D. HttpSessionAttributeListener
E. HttpSessionActivationListener
F. HttpSessionPassivatedListener

3.单项选择题

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.

4.多项选择题Upon a user’s first visit to the website, which two operations are always performed when the getSession method is called with no arguments in a servlet?()

A. All URLs returned by the server are rewritten.
B. An HttpSession object is created if necessary.
C. The user name and password of the user are checked.
D. The session ID is stored in the HTTP response as a cookie.

5.单项选择题Which interface must a class implement to be informed of a session creation event?()

A. javax.servlet.http.HttpSessionListener
B. javax.servlet.http.HttpSessionBindingListener
C. javax.servlet.http.HttpSessionCreationListener
D. javax.servlet.http.HttpSessionActivationListener

6.多项选择题Which the two are concerning the objects available to developers creating tag files?()

A. The session object must be declared explicity.
B. The request and response objects are available implicity.
C. The output stream is available through the implicit outStream object.
D. The servlet context is available through the implicit servletContext object.
E. The JspContext for the tag file is available through the implicit jspContext object.

7.单项选择题Assume a tag handler extends TagSupport. Which is used within the tag handler to get an attribute “foo” that is in the application scope?()

A. pageContext.getAttribute(“foo”);
B. getPageContext().getAttribute(“foo”);
C. pageContext.getApplicationScope(“foo”);
D. pageContext.getAttribute(“foo”,pageContext.APPLICATION_SCOPE).getAttribute(“foo”);
E. getPageContext().getScope(pageContext.APPLICATION_SCOPE).getAttribute(“foo”);

8.多项选择题Which the two about WAR files are true?()

A. WAR files must be located in the web application library directory.
B. WAR files must contain the web application deployment descriptor.
C. WAR files must be created by using archive tools to designed specifically for that purpose. 
D. The web container must serve the content of any META-INF directory located in a WAR file.
E. The web container must allow access to resources in JARs in the web application library directory

10.多项选择题Given that a scoped attribute cart exist only in a user’s session, which two, taken independently, ensure the scoped attribute cart no longer exists?()

A. ${cart = null } 
B. <c:remove var=”cart” /> 
C. <c:remove var=”${cart}” /> 
D. <c:remove var=”cart” scope=”session” /> 
E. <c:remove scope=”session”>cart</c:remove>
F. <c:remove var=”${cart}” scope=”session” /> 
G. <c:remove scope=”session”>${cart}</c:remove>

最新试题

Which the JSTL code snippet can be used to import content from another web resource?()

题型:单项选择题

Within the web application deployment descriptor, which defines a valid JNDI environment entry()

题型:单项选择题

Which code snippet, inserted at line 8, causes the value Company to be output?()

题型:单项选择题

Which statement, at line 16, retrieves an InputStream for the file /WEBINF/ nyresrc.bin()?

题型:单项选择题

Which the three are true about servlet filters?()

题型:多项选择题

Which the two are characteristics of the Service Locator pattern?()

题型:多项选择题

Assume session is an HttpSession, and is not referenced anywhere else in ServletA. Which two changes, taken together, ensure that value is equal to “Hello” on line 23? ()

题型:多项选择题

Which two classes or interfaces provide a getSession method?()

题型:多项选择题

A session-scoped attribute, product, is stored by a servlet. That servlet then forwards to a JSP page. This attribute holds an instance of the com.Company.  Product class with a name property of “The Matrix” and price property of 39.95. Given the JSP page code snippet:What is the response output of this JSP page code snippet? ()

题型:单项选择题

Which is the true choice about the web container request processing model()?

题型:单项选择题