This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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
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: