- Using Hidden Controls
- The Cookie Class
- The HttpServletResponse Interface
- Creating a Cookie
- Reading a Cookie
- Setting and Reading a Cookie in the Same Page
- Using Sessions
- Creating a Session
- Setting Session Timeouts
- Using Applications
- Using Sessions, Applications, and JavaBeans
- Summary
- Q&A
- Workshop
Q&A
Are there any drawbacks to using sessions?
Yes, they put a considerable strain on the resources of the server if there are many sessions running at the same time. They can also be broken unexpectedly if the user's connection fails. All in all, in professional JSP applications, you must be prepared for cases when using a session with the user doesn't work.
Can I store other data in cookies besides the cookie's name, maximum age, and value?
Yes, you can also use the Cookie object's setComment and getComment methods to store a commenta String objectin the cookie. This comment can explain the purpose of the cookie, for example.