Hey everyone. I have tomcat running. Here's a ink from my web site that I am having trouble with. After I input a name , I get the response HTTP method GET is not supported by this URL. http://snydb2001.freeservers.com/introductions.htm In O'Reilly's book, Servlet Programming, it states...
"You might be wondering what would happen had the Hello servlet been accessed with a POST request before we implemented doPost(). The default behavior inherited from HttpServlet for both doGet() and doPost() is to return an error to the cleint saying the requested URL does not support that method".
Now, if you look at my code below, I do have a doGet() method and I do have a GET tag in my html. So why am I getting this error? I have complied it on my machine while running tomcat, so it is not as if tomcat is not functioning since I am getting the error statement. It does recognize the file so there's no error in my classpath or ACTION address in my html. Thanks for your help in advance. HTML CODE
servlet CODE
Bhupinder Dhillon
Ranch Hand
Joined: Oct 12, 2000
Posts: 124
posted
0
[/b]<HR></BLOCKQUOTE>
I assume that's a typo in the method name "goGet", it should be "doGet". Long day at work huh ;-) [This message has been edited by Bhupinder Dhillon (edited April 25, 2001).]
Andrew Shafer
Ranch Hand
Joined: Jan 19, 2001
Posts: 338
posted
0
I don't think the code is a problem. I suspect your server configuration. Unfortunately, I don't have the foggiest idea what you would need to fix the problem
!_I_Know_Kung_Fu_!
Brian Snyder
Ranch Hand
Joined: Feb 03, 2001
Posts: 142
posted
0
Thanks Bhupinder, That was it!!! Wow, I need to get away from the computer for a while. I can't stop laughing, I feel like such a fool. Many Thanks!!!
Desai Sandeep
Ranch Hand
Joined: Apr 02, 2001
Posts: 1157
posted
0
Hi Brian, Am pasting some information from the Java Servlet Specification 2.3, Proposed Final Draft, Section 4.1, Page 34
Posted form data is only read from the input stream of the request and used to populate the parameter set when all of the following conditions are met:
The request is an HTTP or HTTPS request.
The HTTP method is POST
The content type is application/x-www-form-urlencoded
The servlet calls any of the getParameter family of methods on the request object.
If any of the getParameter family of methods is not called, or not all of the above conditions are met, the post data must remain available for the servlet to read via the request�s input stream.
For the above quote, you would have noticed that if you want the posted information to be read the Method had to be POST.Only then your servlet would be able to read the value you input in your HTML page. Hope this helps. Regards,
Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
IBM Enterprise Connectivity with J2EE Scored 72 per cent
Enterprise Development on the Oracle Internet Platform Scored 44 out of 56
<b>Sandeep</b> <br /> <br /><b>Sun Certified Programmer for Java 2 Platform</b><br /> <br /><b>Oracle Certified Solution Developer - JDeveloper</b><br /><b>-- Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java </b><br /><b>-- Object-Oriented Analysis and Design with UML</b><br /> <br /><b>Oracle Certified Enterprise Developer - Oracle Internet Platform</b><br /><b>-- Enterprise Connectivity with J2EE </b><br /><b>-- Enterprise Development on the Oracle Internet Platform </b>
Brian Snyder
Ranch Hand
Joined: Feb 03, 2001
Posts: 142
posted
0
Thanks Desai, but my problem was not with POST but with GET. I had a typo on my code, instead of doGet I had goGet
Bhupinder Dhillon
Ranch Hand
Joined: Oct 12, 2000
Posts: 124
posted
0
Originally posted by Desai Sandeep: If any of the getParameter family of methods is not called, or not all of the above conditions are met, the post data must remain available for the servlet to read via the request�s input stream.
Desai, did you not notice the keyword 'or' in the above statement?
Desai Sandeep
Ranch Hand
Joined: Apr 02, 2001
Posts: 1157
posted
0
Hi Bhupinder,
Desai, did you not notice the keyword 'or' in the above statement?
I had not noticed that "or" keyword in the Servlet Specification.It does change the meaning completely!! However, I remember having faced a similar problem sometime back.When I changed the METHOD=GET to METHOD=POST, it worked.Will need to find out what made that work then??? Regards, ------------------ Sandeep Desai vgdesai@bom3.vsnl.net.in
Sun Certified Java ProgrammerScored 93 per cent
Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
IBM Enterprise Connectivity with J2EE Scored 72 per cent
Enterprise Development on the Oracle Internet Platform Scored 44 out of 56
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: HTTP method GET is not supported by this URL