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

Basic queries about Servlet

 
Irina Banerjee
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


1) HttpServlet is an abstract class without any methods being abstract. In my own class which extends HttpServlet I may not implement any methods. It still compiles and runs but does not do anything useful. Then what is the benefit of not directly instantiating it?

2) I have written one jsp class which sends one GET request to the above servlet. But still the above servlet class runs. But in case of POST method it gives a 405 error. So it seems besides giving error message for POST requests servlet does not give any runtime error for any request even if we don't implement any of its methods.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Irina Banerjee wrote:HttpServlet is an abstract class without any methods being abstract.

This statement is false.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:This statement is false.

This is one of those paradox things. You mean *that* statement is false
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pedant!

Irina: investigate your statement. What false assumption have you made?
 
Irina Banerjee
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you please tell me what the correct statement should be?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You stated:
HttpServlet is an abstract class without any methods being abstract.

Can you back up this statement with fact? What makes you think that this statement is true? How do you support the validity of the statement?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic