my dog learned polymorphism*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Multiple Servlet Objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Multiple Servlet Objects" Watch "Multiple Servlet Objects" New topic
Author

Multiple Servlet Objects

Sandeep Vaid
Ranch Hand

Joined: Feb 27, 2006
Posts: 390
If we define multiple <servlet> elements of same SERVLET in web.xml, then web contianer will create multiple Servlet Objects. Right?

This may be useful for example you may want one instance to connect to one database and second instance to connect to another database...
Rishi Chopra
Ranch Hand

Joined: Mar 07, 2004
Posts: 108
hi yes you are right one first point

but i dont agree on the fact that you are thinking of making two instances of one servlet merely to connect to two different databases .

Regards
Rishi


Life is Beautiful Learn to See it.........
Jon Lee
Ranch Hand

Joined: Mar 04, 2005
Posts: 134
Database connection should be an plain old Java object.


SCJP 5.0 - 98% (2007)<br />SCWCD 1.4 - 97% (2007)
Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
yes....keeping in mind the design patterns the database connection should be done in a model and not in a controller.. !


SCJP 1.4 - 95% [ My Story ] - SCWCD 1.4 - 91% [ My Story ]
Performance is a compulsion, not a option, if my existence is to be justified.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple Servlet Objects
 
Similar Threads
Database instances
Wonder about one of the SCWCD whizlabs question?
Which of the following statements is correct regarding the servlets that implement
Q about servlet instances in containers.
servlet pool