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
6 months agoRonny
5 months agoKarol
5 months agoMozelle
5 months agoLisandra
5 months agoSol
6 months agoMireya
5 months agoNakita
5 months agoWilliam
5 months agoBuffy
5 months agoIrene
6 months agoWei
6 months agoJamey
6 months agoJennifer
6 months agoCaren
6 months agoEstrella
4 months agoDawne
4 months agoVincenza
4 months agoShelba
4 months agoFelice
4 months agoVernice
5 months agoViola
5 months agoStephen
5 months agoRoselle
6 months agoEleni
6 months agoStevie
6 months agoRoyce
6 months agoSherita
6 months agoMireya
6 months agoAlfreda
7 months ago