title: HTTP Status 404 – Not Found upon clicking Submit button with form tag in JSP
body: <p>I've created a simple form in my html file with a submit button for a username and password but upon clicking the submit button <strong>TOMCAT shows an error</strong> </p>
  
  <blockquote>
    <p>"The origin server did not find a current representation for the
    target resource or is not willing to disclose that one exists."</p>
  </blockquote>
  
  <p>I tried changing the url-pattern and servlet-name still and none of it works.</p>
  
  <p>Here is the <strong>web.xml</strong> file content</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"&gt;
    &lt;display-name&gt;DemoWebCRUDApp&lt;/display-name&gt;
    &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;HomePage.html&lt;/welcome-file&gt;
    &lt;/welcome-file-list&gt;
  
    &lt;servlet&gt;
      &lt;servlet-name&gt;loginServlet&lt;/servlet-name &gt;
      &lt;servlet-class&gt;com.demoCRUD.servlet.UserLoginServlet&lt;/servlet-class&gt;
    &lt;/servlet&gt;
  
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;loginServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/loginValidation&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p><strong>HomePage.html</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset="ISO-8859-1"&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt; 
  
      Login Form
      &lt;form action="/loginValidation" method ="get"&gt;
          Username: &lt;input type="text" name="username"/&gt;
          &lt;br&gt;
          Password: &lt;input type="text" name="password"/&gt;
          &lt;br&gt; 
          &lt;input type="submit" value="Log In"/&gt;
      &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and the <strong>UserLoginServlet</strong></p>
  
  <pre><code>package com.demoCRUD.servlet;
  
  import java.io.IOException;
  
  import javax.servlet.RequestDispatcher;
  import javax.servlet.ServletException;
  import javax.servlet.annotation.WebServlet;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  import com.demoCRUD.dao.UserDAO;
  
  
  public class UserLoginServlet extends HttpServlet 
  {
  
      public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          String username = String.valueOf(request.getAttribute("username"));
          String password = String.valueOf(request.getAttribute("password"));
  
      }
  }
  </code></pre>
  
  <p>Here is the setup for the Project</p>
  
  <p><a href="https://i.stack.imgur.com/GC5mI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GC5mI.png" alt="enter image description here"></a></p>