title: Unable to submit form from JSP to Servlet
body: <p>I am a beginner at JSP and Servlets. In my application folder structure is as follows:</p>
  
  <pre><code>Servlet Class: LearningJSP\src\servlet\UserDetailsServlet.
  
  Jsp file : JSP\Inputform.jsp
  </code></pre>
  
  <p>The code is as follows:</p>
  
  <pre><code>package servlet;
  
  import java.io.IOException;
  
  import javax.servlet.ServletException;
  
  import javax.servlet.annotation.WebServlet;
  
  import javax.servlet.http.HttpServlet;
  
  import javax.servlet.http.HttpServletRequest;
  
  import javax.servlet.http.HttpServletResponse;
  
  
  /**
   * Servlet implementation class UserDetails
   */
  
  @WebServlet(urlPatterns = {"/userdetails"})
  
  public class UserDetailsServlet extends HttpServlet
  {
      private static final long serialVersionUID = 1L;
  
      /**
       * @see HttpServlet#HttpServlet()
       */
      public UserDetailsServlet()
      {
          super();
      }
  
  
      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
      {
          String name = request.getParameter("name");
          String surname = request.getParameter("surname");
          String age = request.getParameter("age");
  
          javabeans.UserDetailsValue userDetails = new javabeans.UserDetailsValue();
          userDetails.setAge(age);
          userDetails.setName(name);
          userDetails.setSurname(surname);
  
          request.setAttribute("message", "saved successfully.");
          request.getRequestDispatcher("/UserDetails.jsp").forward(request, response);
      }
  
  }
  </code></pre>
  
  <p>InputForm.jsp</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &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=ISO-8859-1"&gt;
  &lt;title&gt;Form&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt;Please fill up the data for Registration.&lt;/h1&gt;
  &lt;form action = "/userdetails" method = "GET"&gt;
  &lt;input type = "text" name = "name"&gt;&lt;br&gt;
  &lt;input type = "text" name = "surname"&gt;&lt;br&gt;
  &lt;input type = "text" name = "age"&gt;&lt;br&gt;
  &lt;input type = "submit" value = "Register"&gt;&lt;br&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I am getting </p>
  
  <blockquote>
    <p>Error 404: Resource not found.</p>
  </blockquote>
  
  <p>I think there is some mistake in Url in action tag in JSP, but after many trials I coundn't find my mistake.</p>
  
  <p>Please help me to find error.
  Thanks in advance</p>