my dog learned polymorphism*
The moose likes Servlets and the fly likes Basic queries about Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Basic queries about Servlet" Watch "Basic queries about Servlet" New topic
Author

Basic queries about Servlet

Irina Banerjee
Greenhorn

Joined: Jul 03, 2010
Posts: 2
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

Joined: Jan 10, 2002
Posts: 60046
    
  65

Irina Banerjee wrote:HttpServlet is an abstract class without any methods being abstract.

This statement is false.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Jan 10, 2002
Posts: 60046
    
  65

Pedant!

Irina: investigate your statement. What false assumption have you made?
Irina Banerjee
Greenhorn

Joined: Jul 03, 2010
Posts: 2
Could you please tell me what the correct statement should be?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60046
    
  65

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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Basic queries about Servlet
 
Similar Threads
who provides functionality....
HttpServlet
Is HttpServlet an abstract class or interface?
Question related to Abstract class HttpServlet
HttpServlet absract class