title: Servlet not found in Intellij
body: <p>I trying to run my jsp page along with a servlet. The Servlet is not found when I try to call it via url</p>
  
  <p><a href="http://localhost:8080/StudentServlet" rel="nofollow noreferrer">http://localhost:8080/StudentServlet</a> 
  I get a 404 error saying: </p>
  
  <blockquote>
    <p>"requested resource not available".</p>
  </blockquote>
  
  <p>I am also trying to call it via a Form. When I click submit, its not recognised either producing same error.</p>
  
  <p>Read answers here asking to use Maven or set up mapping via web.xml. From my understanding, setting up via web.xml is the old way and the new way is to set up name on the servlet which I have. Unsure what I am doing wrong. </p>
  
  <p>I am not using and build tool and just starting up my Tomcat server used locally to run jsp pages which works. But Servlets are not recognised. Added screenshot for project structure in case something is wrong there.  </p>
  
  <p><strong>Servlet</strong>  </p>
  
  <pre><code>@WebServlet(name = "StudentServlet")
  public class StudentServlet extends HttpServlet {
      protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  
      }
  
      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  
          response.setContentType("text/html");
  
          PrintWriter out = response.getWriter();
  
          out.println("&lt;html&gt;&lt;body&gt;");
  
          out.println("&lt;h3&gt;Student name is:" +
                  request.getParameter("firstname") +
                  " " +
                  request.getParameter("lastname") +
                  "&lt;/h3&gt;");
  
          out.println("&lt;/body&gt;&lt;/html&gt;");
  
      }
  }
  </code></pre>
  
  <p><strong>index.jsp</strong></p>
  
  <pre><code>&lt;form action="StudentServlet" method="get"&gt;
      First Name: &lt;input type="text" name="firstname"/&gt;
      &lt;br/&gt;&lt;br/&gt;
      Last Name: &lt;input type="text" name="lastname"/&gt;
      &lt;br/&gt;&lt;br/&gt;
      &lt;input type="submit" value="Submit"/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>Project Structure</strong></p>
  
  <p><a href="https://i.stack.imgur.com/8Iq8Q.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8Iq8Q.jpg" alt="enter image description here"></a></p>