Results 1 to 2 of 2
  1. #1
    Jarran is offline Member
    Join Date
    Nov 2011
    Posts
    1
    Rep Power
    0

    Default The specified HTTP method is not allowed for the requested resource (HTTP method GET

    The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).

    I am beginning my quest for the power of EJB. I am working thorough tutorials and have run into the above issue.

    IDE: Eclipse Gallileo
    Server: Tomcat 7

    HomeServlet.java:
    package website.web;

    import java.io.IOException;
    import java.io.PrintWriter;

    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;

    @SuppressWarnings("serial")
    public class HomeServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException {
    PrintWriter writer = resp.getWriter();
    writer.println("<h1>Hello, World!</h1>");
    super.doGet(req, resp);
    }

    }


    web.xml:
    <?xml version="1.0"?>
    <web-app
    xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">
    <servlet>
    <servlet-name>home</servlet-name>
    <servlet-class>website.web.HomeServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>home</servlet-name>
    <url-pattern>/home</url-pattern>
    </servlet-mapping>
    </web-app>

    I hope this is an obvious problem, thanks...

  2. #2
    ttzhao is offline Member
    Join Date
    Mar 2012
    Posts
    2
    Rep Power
    0

    Default Re: The specified HTTP method is not allowed for the requested resource (HTTP method

    You should remove "super.doGet(req, resp);"

Similar Threads

  1. connect to http URL and abstract method
    By axa in forum Networking
    Replies: 1
    Last Post: 09-05-2011, 12:40 PM
  2. HTTP Status 404-The requested resource is not available.
    By DeViLHuNTeR in forum Java Servlet
    Replies: 17
    Last Post: 03-11-2011, 02:40 PM
  3. HTTP request method associated with an URL
    By Sonal R N in forum Networking
    Replies: 0
    Last Post: 02-21-2011, 08:35 AM
  4. Replies: 7
    Last Post: 11-11-2009, 08:29 PM
  5. Getting information about HTTP response method
    By Shiv in forum New To Java
    Replies: 0
    Last Post: 04-10-2009, 07:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •