title: HTTP method GET is not supported by this URL
body: <p>I am getting the subjected error, could you please help</p>
  
  <p>servlet</p>
  
  <pre><code>public class FirstClass extends HttpServlet {
  
      private static final long serialVersionUID = 1L;
  
      public void doGet(HttpServletResponse response, HttpServletRequest request) throws IOException, ServletException {
          PrintWriter out = response.getWriter();
          out.println("this is a sample");
          out.flush();
      }
  
      public void doPost(HttpServletResponse response, HttpServletRequest request) throws IOException, ServletException {
          PrintWriter out = response.getWriter();
          out.println("this is a sample");
          out.flush();
      }
  }
  </code></pre>
  
  <p>web.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app id="WebApp_ID" version="2.4" 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"&gt;
      &lt;display-name&gt;hii&lt;/display-name&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;First&lt;/servlet-name&gt;
          &lt;servlet-class&gt;test.FirstClass&lt;/servlet-class&gt;
      &lt;/servlet&gt;
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;First&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/first.do&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>index.html</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;a href="first.do"&gt;Click Me&lt;/a&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>