SESSION Tutorials in Java Web Application,What is Session,Session example in JSP


SESSION in Java Web Application:-  It is used to provide server-side state management option using Session object we can store page content( data) after response means session provides a persistent object which can retain data in browser cookie or database then we can use it into different web pages.
The session is mandatory to create login forms in a web application because session will provide dynamic objects for multiple users to contain information.
for example if five different users login to the system then the session object provides a separate identity to all five users.
the session always will be created after login and destroy after logout. without a session, we can not handle login and logout operation.
Syntax to create in Servlet:-
HttpSession ref = request.getSession();
Syntax to destroy session
HttpSession ref = request.getSession();
Syntax to create session in JSP:-
Syntax to remove session in JSP
The session is used to provide security if we want to restrict users to access the internal page without login then using the session object we can proceed to user's in the login page.we should always check session data that it is set or not.

Post a Comment


POST Answer of Questions and ASK to Doubt

Post a Comment (0)