Servlet Collections
I have been collecting these notes from various Web Sites, Discussion Forums and my own experience. To be more precise most of these Questions and Answers are taken from Java ranch forum and I like to personally thank every individual for coming up with such interesting thoughts and solutions. You will the rest of the stuff in the archives section which are not listed in this page.
Sunday, August 03, 2008
Thursday, January 03, 2008
Saturday, August 19, 2006
When to use instance variables in servlets.
As a general rule of thumb: never create instance variables in a servlet unless you really understand how servlets work in regards to threading. Containers will create one instance of your servlet and call your servlet's service methods (doGet, doPost, etc...) from within a separate thread for each request. This means that any instance varaibles will be shared among all of your requests.
Here is a link that explains when instance variables should and shouldn't be used in servlets.
For password changing is it advisable to set the password in session as attribute and check it while modifying.
NO. Always retrive the password from database while making a comparison check to allow the user to change password.
We are facing a problem with session timeout. As per requirement we need to have different timeout values for different pages. i.e. to say 40 min for page A and 45 min for page B. Is there any way this configuration can be done.
You can change it at runtime but changing one page will affect them all.There is only one session object per session.
setMaxInactiveInterval(int)
If you want a per-page timeout, you will have to do it with some other mechanism besides the session -- probably JavaScript timers on the various pages.
Thursday, July 13, 2006
Tuesday, March 21, 2006
Why should we use destroy() method in servlet when we have finalize() method to de-allocate resources.
Check this link.
Check this link.
Tuesday, March 14, 2006
Friday, March 10, 2006
Request Headers:
response headers go from the server to the browser and request headers go from the browser to the server.
Read this thread for better understanding.
Here is a link that talks about sending data back to the client.
Retrieving a parameter from a link
Check it here
HttpServlet.getLastModified() method purpose and usage.
Check it here
The two most significant filters that every web application should have.
Compression and Caching Filters