You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by Sammy Lau <sa...@outblaze.com> on 2000/11/21 11:44:33 UTC
servlet resources question
Hi all,
In the following servlet, the Hashtable _formdata is initialized only
once during the life time of the tomcat process. i.e. the data I put
into _formdata stays in the memory until I restart tomcat.
I've got a few questions:
1. I'd like to know where I could find any doc describing the life cycle
of a servlet.
It seems that destroy() never got called.
2. I can resolve the problem by doing _formdata = new Hashtable() every
time running the servlet. However,
what will tomcat do with the in-memory data of the old instance of
_formdata?
I'm using tomcat 3.2 beta6, apache 1.3.12 and using mod_jk to serve
between.
Your reply is highly appreciated. Thanks.
public class MyServlet extends HttpServlet
{
private Hashtable _formdata = null;
public void service(HttpServletRequest request,
HttpServletResponse response)
{
if (this._formdata == null)
{
System.out.println("initializing _formdata");
_formdata = new Hashtable();
}
//putting Query parameters into _formdata
//Displaying Query parameters
}
}
--
Cheers,
Sammy Lau
Outblaze Co. Ltd.
Mail: sammy@outblaze.com