Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Singleton VS ServletContext VS Inheritance

843842Jan 16 2009 — edited Jan 19 2009
I 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...?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 16 2009
Added on Jan 16 2009
12 comments
292 views