SCJP 1.4 SCWCD 1.4 SCDJWS 1.4
SCJP 1.4, www.gsi3d.org.uk
42
SCJP 1.4 SCWCD 1.4 SCDJWS 1.4
SCJP 1.4 SCWCD 1.4 SCDJWS 1.4
Originally posted by karthik rajendiran:
since we extend Httpservlet ,we should get the doGet method of the HttpServlet class in our HelloWorld.
When i deploy i got 405 error, application doesnt not support GET.
Why is this thing.
Wht is the purpose of doGet in HttpServlet. Is it mandatory ot override get.
The doGet method that you inherit does nothing but throw an exception, stating that "doGet is not supported".
Originally posted by karthik rajendiran:
Hello Ben,
This is karthik and its regarding the servlet clarification.
i have already posted the message in the forum,but needs to get more satisfactory reply.I hope u can give me the answer.
While writing servlet , we extend HttpServlet class,
suppose i request from the HTML with GET Method.
Let HelloWorld be the servlet i have written. It extends HttpServlet.
It has no POST method in it.
I am not calling doGet anywhere in my HelloWorld servlet.
since we extend Httpservlet ,we should get the doGet method of the HttpServlet class in our HelloWorld.
When i deploy i got 405 error, application doesnt not support GET.
Why is this thing.
Wht is the purpose of doGet in HttpServlet. Is it mandatory ot override get.
Explain in detail please.
thanks in advanc
Originally posted by David O'Meara:
Jeroen,
please don't come into my forum and belittle my visitors. Not all visitors to the 'Ranch have English as their first language and sometimes some interpretation is required.
When you decide to be helpful your posts are of great assistance, but if this is not going to be the case please limit yourself to MD.
Dave
SCJP 1.4<br />SCWCD(in process)
Originally posted by Chaitanya Athanikar:
Hey karthik,
The doGet() method we get from inheretence need to be overidden to be used in our servlet.By default html sends the request using GET method.
You would have doGet() method from HttpServlet but it would not be useful as no code is written in it to handle your sepecific request.
The server tries to look for your specific doGet() method version in your class and not the doGet() of HttpServlet.With my understanding you need to explicitly override doGet() or else declare mehtod="post" in your html form.
I hope I have answered your question a little bit atleast.
Originally posted by karthik rajendiran:
Hi,
First of all u have to understand why u r extending the HttpServlet Class, if u want any Http Method to be handled in ur servlet better you override the service method,
your container is designed to handled your servlets depending on the Http methods,
once you override the doPost method and not the doGet, your container understands that you are restricting the user by sending the request by GET method, hence the error,
no wonder he is so sad, he hasn't seen this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|