- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can you delete a session data in JSP?
517 Lectures 57 hours
When you are done with a user's session data, you have several options −
Remove a particular attribute − You can call the public void removeAttribute(String name) method to delete the value associated with the particular key.
Delete the whole session − You can call the public void to invalidate() method to discard an entire session.
Setting Session timeout − You can call the public void setMaxInactiveInterval(int interval) method to set the timeout for a session individually.
Log the user out − The servers that support servlets 2.4, you can call log out to log the client out of the Web server and invalidate all sessions belonging to all the users.
web.xml Configuration − If you are using Tomcat, apart from the above-mentioned methods, you can configure the session time out in web.xml file as follows.
<session-config> <session-timeout>15</session-timeout> </session-config>
The timeout is expressed as minutes and overrides the default timeout which is 30 minutes in Tomcat.
The getMaxInactiveInterval( ) method in a servlet returns the timeout period for that session in seconds. So if your session is configured in web.xml for 15 minutes, getMaxInactiveInterval( ) returns 900.
- How to delete Session data in JSP?
- How can you upload a file using JSP?
- How is Session Management done in JSP?
- How can you read a request header information in JSP?
- What is session attribute in JSP?
- What is the session Object in JSP?
- How to execute DELETE SQL in a JSP?
- How can you delete a table from a database in MySQL Python?
- Please share a working example of session maintenance in JSP.
- How to delete cookies with JSP?
- How can you delete a record from a table using MySQL in Python?
- How to track access time of a webpage using session in a JSP page?
- How do you define multiple filters in JSP?
- How do you set cookies in the JSP?
- How do you implement hit counter in JSP?