File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Create two instance of Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Create two instance of Servlet" Watch "Create two instance of Servlet" New topic

Create two instance of Servlet

Shrawan Bhageria
Ranch Hand

Joined: Jun 20, 2005
Posts: 52
Hi All,

Please let me know how we create two instance of servlet in multithreaded servlet.

David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Servlets are already multithreaded, you do not need to create multiple instances or even manage the instances - it is the container's job to do this for you.

Ben Souther

Joined: Dec 11, 2004
Posts: 13410

If you want two servlet instances from the same servlet class, create two servlet entries in your deployment descriptor. Give them each unique names.

Why would you want to do this?

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: Create two instance of Servlet
jQuery in Action, 3rd edition