Singleton VS ServletContext VS Inheritance
843842Jan 16 2009 — edited Jan 19 2009I just poseted this in a reply to another thread, but I think it deservs its own.
I'm confused on how to implemente something like a database access between two servlets, say a Login Servlet and a Registration Servlet. Both need to access cuncurrently to the database using the same connection.
So three ways of doing this are with a Singleton Object, which handles database access. Sharing that same Object through the ServletContext and instead of having an object to handle database access, handle it in a Servlet which will then be inherited by both the Login a Registration Servlets...
I was looking for your opinion on which would be the best way to implement this...?