aspose file tools*
The moose likes Servlets and the fly likes can i create object for our own servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "can i create object for our own servlet" Watch "can i create object for our own servlet" New topic
Author

can i create object for our own servlet

sujitha reddy
Greenhorn

Joined: Oct 20, 2006
Posts: 15
hi,
this is madhu

can i create a object of our own servlet class.What is the use of that object.
[ October 20, 2006: Message edited by: Bear Bibeault ]
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
Servlet is not special java class.You can create a servlet object.but that you cannot expect to work as a servlet.


Rahul Bhattacharjee
LinkedIn - Blog
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12825
    
    5
Just to expand on what Rahul said, instances of a servlet are created and managed by a servlet container. This is similar to the way instances of an applet are created and managed by a browser.

Because servlet operation depends on the servlet context, request, response, etc etc provided by the container, there is nothing to be gained by creating one outside the container envrironment. Although I have seen servlet classes with a main method so they can be executed directly, this is a symptom of bad architecture.

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can i create object for our own servlet