Hi All, I am currently building a web app using tomcat and the MVC design pattern - controllerservlet, beans and jsp's.
I get a connection to the database in my init method in the servlet and then I would like to save it to the servlet context for access by my beans (that do the actual sql queries). However, I cannot seem to get it to work. I am using getServletContext().setAttribute("connection",conn); to try to save it to the context. I know my connection code works, and I know my beans work. But when I put it all together I cannot save the connection to the Context. This will be much more efficent than getting every bean to connect/disconnect each time. And there is no need to a ConnectionPool as the system will be used only once a day by one person. Am I going about it the right way ?? I cannot think of another way to approach it........ thanks in advance Chris
posted 14 years ago
whoops this was meant for the serlvets forum - I have reposted there !
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads