Java, .NET, PHP, PYTHON, ANGULAR, .NET, ML, Data Scince, Testing, CI Tutorials in Easy Languages.

"Best Software Training, Internship, Project Development center of Indore India, Helpline 780506-3968"

Session in JSP and Servlet:-
It is the persistent variable which is used to contain the data from one web page to another.session is also called server-side state management option.


The session always will be created by a web server and manage by browser cookies by default.we can create a cookieless session also using a database server.


The session is mandatory to manage user login, admin login functionality because if we want to display user-specific data after login then the session is mandatory.


If we want to provide internal page security in web applications then also we will use the session.


Syntax of Session in Servlet:-


HttpSession session = request.getSession()
session.setAttribute("key","value");



Syntax of Session in jsp:-

session.setAttribute("key","value");


Syntax to destroy session object:-
HttpSession session = request.getSession()
session.removeAttribute("key");
session.inValidate()


Syntax to get data from session object?

session.getAttribute("key");



Post a Comment

If you have any doubt in programming or join online classes then you can contact us by comment .

Previous Post Next Post