| Author |
HTTP error 405
|
shilpa nara
Greenhorn
Joined: Dec 03, 2002
Posts: 3
|
|
Have been trying to run this very simple servlet... but i get the foll error: Apache Tomcat/4.0.3 - HTTP Status 405 - HTTP method GET is not supported by this URL type Status report message HTTP method GET is not supported by this URL description The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL). ------------ My code is as follows import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; public class try1 extends HttpServlet { public void doGet(HttpServletResponse res, HttpServletRequest req) throws ServletException, IOException { res.setContentType("Text/HTML"); PrintWriter out= res.getWriter(); out.println("<HTML>"); out.println("<Body>"); out.println("First Servlet"); out.println("</Body>"); out.println("</HTML>"); } } Can someone explain why this error occurs. Do i need to call this page from an HTML page thanks shilpa
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12268
|
|
It is possible your servlet is not even being loaded, much less called due to some sort of naming problem. You should add an init method and have that init method do a System.out or write to a log so you can tell if it is even being initialized. (oh - also you need to close out so it will be flushed.) Bill
|
Java Resources at www.wbrogden.com
|
 |
 |
|
|
subject: HTTP error 405
|
|
|