Hi Folks, I want to keep only one instance of an object on my Jserv which should be available to all the servlets all the time. Before I modify the code, I am seeking for your suggestion. IS IT OK TO DECLARE AND INITIALISE THAT OBJECT IN THE SERVLETCONTEXT CLASS ? WILL IT WORK ? Thanks
SCJP2
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12269
1
posted
0
I would certainly do it with a "Singleton" pattern class. You could store the resulting object in the ServletContext - as long as there is only one server. Surely you are not talking about modifying ServletContext - no need for that. Bill ------------------ author of: