Difference between using getSession (true) and getSession(false) methods

What is the difference between using getSession(true) and getSession(false) methods?


  • getSession(true) will check whether a session already exists for the user. If yes, it will return that session object else it will create a new session object and return it.

  • getSession(false) will check existence of session. If session exists, then it returns the reference of that session object, if not, this methods will return null.



If you like Codersarts blog and looking for Programming Assignment Help Service, Database Development Service,Web development service,Mobile App Development, Project help, Hire Software Developer,Programming tutors help and suggestion you can send mail at contact@codersarts.com.


Please write your suggestion in comment section below if you find anything incorrect in this blog post


Contact Us

Tel: (+91) 0120  4118730  

Time :   10 : 00  AM -  08 : 00 PM IST 

Registered address: G-69, Sector 63, 

 Noida - 201301, India

We Provide Services Across The different countries

USA    Australia   Canada   UK    UAE    Singapore   New Zealand    Malasia   India   Ireland   Germany

CodersArts is a Product by Sofstack Technology Solutions Pvt. Ltd.

  • CodersArts | Linkedin