What is session in JAVA? - ProProfs Discuss
Advertisement

What is session in JAVA?

What is session in JAVA?<br/>

Change Image    Delete

Asked by Kvpbusiness, Last updated: Nov 09, 2024

+ Answer
Request
Question menu
Vote up Vote down

2 Answers

G. Cole

G. Cole

Find happiness in writing new things.

G. Cole
G. Cole, English Professor, PhD, Canterbury

Answered Sep 25, 2020

Session in Java simply refers to the time interval or time differences of which two systems (which are the server and the clients) communicate with each other. In other words, we can say a session is a state that consists of various requests and responses between the server and the clients.

The parameter that helps in managing session in Java is referred to as the HttpSession object. A session is consists of information which are specific to a user in particular throughout the whole application. If you are a new user, and you enter an online application or a website for the first time, you can obtain the HttpSession via request.getSession().

Then you will be given a unique ID for you to identify your session. The unique ID can either be stored in a request parameter or info a cookie. Httpsessioninterface is an interface provided by servlets in Java, and it consists of several methods.

upvote downvote
Reply 

kvpbusiness

kvpbusiness

kvpbusiness
Kvpbusiness

Answered Nov 13, 2017

Only the Session that you obtained with sf.getCurrentSession() is flushed and closed automatically
upvote downvote
Reply