title: Why I need mapping or annotation for Servlet, but not for JSP?
body: <p>To make a request to Servlet, I need to use mapping inside XML file or add annotation for given Servlet. But why I am not required to do the same for JSP files as well? I will give examples.</p>
  <p><strong>How does this work?</strong></p>
  <p>index.html:</p>
  <pre><code>&lt;html&gt;&lt;body&gt;
   
      &lt;form action=&quot;result.jsp&quot;&gt;
          &lt;button&gt;go&lt;/button&gt;
      &lt;/form&gt;
      
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  <p>result.jsp:</p>
  <pre><code>&lt;html&gt;&lt;body&gt;
  hello
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  <p>Notice I didn't have to use any XML mappings nor annotations. It just &quot;finds&quot; it.</p>
  <p><strong>But how this doesn't work?</strong></p>
  <p>index.html:</p>
  <pre><code>&lt;html&gt;&lt;body&gt;
   
      &lt;form action=&quot;com.example.MyServlet&quot;&gt;
          &lt;button&gt;go&lt;/button&gt;
      &lt;/form&gt;
      
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  <p>com.example.MyServlet:</p>
  <pre><code>public class MyServlet extends HttpServlet {
   
      @Override
      protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
          PrintWriter pw = resp.getWriter();
          resp.setContentType(&quot;text/html&quot;);
   
          pw.println(&quot;hello&quot;);
   
      }
  }
  </code></pre>
  <p>Here, I get error: <em>The requested resource [/TestProject/com.example.MyServlet] is not available</em>. How? How come I didn't need to use XML, nor annotations for JSP, but I had for Servlet? Shouldn't they work the same way, as JSP eventually turns to Servlet. So why is there different behavior? I know I am missing something, I just don't know what...</p>