You work as a Software Developer for UcTech Inc. You want to create a new session. Which of the following methods can you use to accomplish the task?
Each correct answer represents a complete solution. Choose all that apply.
The getSession() method of the HttpServletRequest interface returns the current session associated with the request, or creates a new
session if no session exists. The method has two syntaxes as follows:
public HttpSession getSession(): This method creates a new session if it does not exist.
public HttpSession getSession(boolean create): This method becomes similar to the above method if create is true, and returns the
current session if create is false. It returns null if no session exists.
Answer B is incorrect. The getSession(false) method returns a pre-existing session. It returns null if the
client has no session
associated with it.
Answer A and E are incorrect. There is no such method as getNewSession() in Java.
Afton
7 months agoRonny
6 months agoKarol
6 months agoMozelle
6 months agoLisandra
6 months agoSol
7 months agoMireya
6 months agoNakita
6 months agoWilliam
6 months agoBuffy
6 months agoIrene
7 months agoWei
7 months agoJamey
7 months agoJennifer
7 months agoCaren
7 months agoEstrella
5 months agoDawne
5 months agoVincenza
5 months agoShelba
5 months agoFelice
5 months agoVernice
6 months agoViola
6 months agoStephen
6 months agoRoselle
7 months agoEleni
7 months agoStevie
7 months agoRoyce
7 months agoSherita
7 months agoMireya
7 months agoAlfreda
8 months ago