which statement must be inserted at line 42?

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 exists
47. }
To implement the design intent, which statement must be inserted at line 42?

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 exists
47. }
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”);



Leave a Reply 2

Your email address will not be published. Required fields are marked *


Allan Santos

Allan Santos

D.

getSession() and getSession(true) will force create session in case of need.