Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP method GET is not supported by this URL

 
Stephen Selvaraj
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
i m using Tomcat5.0, i m tryin to run a sample servlet.
when i typin the url i get the following status
"HTTP method GET is not supported by this URL"
I have both the doGet and doPost method done..
Pls have a look at my code snippet and guide if i m wrong..

many thanx in advance
java nut!

public class TestServlet extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
System.out.println("Inside TestServlet"); request.getRequestDispatcher("/jsp/welcome.jsp").forward(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
doGet(request,response);
}

}

web.xml
-------
<servlet>
<servlet-name>TestServlet</servlet-name>
<servlet-class>com.mymail.TestServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>TestServlet</servlet-name>
<url-pattern>/TestServlet</url-pattern>
</servlet-mapping>
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That should be working.

Did you have both methods in the servlet from the beginning?
If not, stop Tomcat, delete the class file, re-compile, and try again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic