File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can i create object for our own servlet

 
sujitha reddy
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Servlet is not special java class.You can create a servlet object.but that you cannot expect to work as a servlet.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13045
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic