多选题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?()AAll URLs returned by the server are rewritten.BAn HttpSession object is created if necessary.CThe

题目
多选题
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.

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

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

正确答案:A

第2题:

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

第3题:

Which two are true?()

A.A finalizer may NOT be invoked explicitly.

B.The finalize method declared in class Object takes no action.

C.super.finalize()is called implicitly by any over riding finalize method.

D.The finalize method for a given objec twill be called no more than once by the garbage collector.

E.The order in which finalize will be called on two objects is based on the order in which the two objects became finalizable.


参考答案:B, D

第4题:

Which of the following statements about variables and scope are true?() 

  • A、 Local variables defined inside a method are destroyed when the method is exited.
  • B、 Local variables are also called automatic variables.
  • C、 Variables defined outside a method are created when the object is constructed.
  • D、 A method parameter variable continues to exist for as long as the object is needed in which the method is defined.

正确答案:A,B,C

第5题:

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.

正确答案:B,D

第6题:

In your web application,you need to execute a block of code whenever the session object is first created. Which design will accomplish this goal?()

  • A、Create an HttpSessionListener class and implement the sessionInitialized method with that block ofcode.
  • B、Create an HttpSessionActivationListener class and implement the sessionCreated method with thatblock of code.
  • C、Create a Filter class, call the getSession(false) method, and if the result was null, then execute that block of code.
  • D、Create an HttpSessionListener class and implement the sessionCreated method with that block of code.

正确答案:D

第7题:

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

  • A、 The init method on a filter is called the first time a servlet mapped to that filter is invoked
  • B、 A filter defined for a servlet must always forward control to the next resource in the filter chain.
  • C、 Filters associated with a named servlet are applied in the order they appear in the web application deployment descriptor file
  • D、 If the init method on a filter throws an UnavailableException, then the container will make no further attempt to execute it

正确答案:C

第8题:

Which two prevent a servlet from handling requests.?()

  • A、 The servlet’s init method returns a non-zero status.
  • B、 The servlet’s init method throws a Servlet Exception
  • C、 The servlet’s init method sets the Servlet Response’s context length to 0
  • D、 The servlet’s init method sets the Servlet Response’s content type to null.
  • E、 The servlet’s init method does NOT return within a time period defined by the servlet container.

正确答案:B,E

第9题:

Two new servers are purchased and need to be installed to allow sharing of a single external hard drive enclosure.  One server is configured as a local file server, and the other as a database server for a different network.  The onsite technician notices that when both servers are running at the same time, they each receive SCSI errors. When they are running individually, no errors are reported.   Which of the following is the BEST source of information to use for troubleshooting this problem?()

  • A、 the server vendor’s FAQ website
  • B、 the SCSI controller vendor’s user manual
  • C、 the drive enclosure vendor’s user manual
  • D、 the network operating system vendor’s website

正确答案:C

第10题:

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

  • A、javax.servlet.http.HttpServletRequest
  • B、javax.servlet.http.HttpSessionContext
  • C、javax.servlet.http.HttpServletResponse
  • D、javax.servlet.http.HttpSessionBindingEvent
  • E、javax.servlet.http.HttpSessionAttributeEvent

正确答案:A,D

更多相关问题