session

Quiz Guidelines

 

Multiple Choice Question

QID: 
9

Given an HttpServletRequest request and an httpServletResponse response:

HttpSession session = null;
/ / insert code here
if (session = = null) {
/ / do something if session does not exist
} else {
/ / do something if session exists
}

Which of the code below is more appropriate to be inserted instead of the line that contains '/ / insert code here' ?

A. session = response.getSession ();
B. session = request.getSession ();
C. session = request.getSession (true);
D. session = request.getSession (false);
E. session = request.getSession (“jsessionid”);