title: HTTP status 404 requested resource not available
body: <p>I've been trying to find the solution for my problem since a week but couldn't succeed.
  There may be more than 100 same questions of this type, but they not helping me at all.
  Pls if anyone can explain what exactly is URL mapping and how it is done?</p>
  
  <p>I'm using tomcat 7 and eclipse java EE. my jsp file is running properly but when I click submit the error appears. I have tried almost everthing. pls let me know what mistake I'm making.</p>
  
  <p>here's my jsp code: </p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
  pageEncoding="ISO-8859-1"%&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form method="post" action="/calculator/calc"&gt;
  &lt;input type="text" name="n1"&gt;&lt;br&gt;
  &lt;input type="text" name="n2"&gt;&lt;br&gt;
  &lt;input type="submit"&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Servlet code:</p>
  
  <pre><code>public class calc extends GenericServlet 
  {
  public void service(ServletRequest req,ServletResponse res) throws IOException
  {
      res.setContentType("text/jsp");
      PrintWriter pw=res.getWriter();
      String s1=req.getParameter("n1");
      String s2=req.getParameter("n2");
      int a=Integer.parseInt(s1);
      int b=Integer.parseInt(s2);
      pw.println(a+b);
     }
  }
  </code></pre>
  
  <p>And web.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;display-name&gt;calculator&lt;/display-name&gt;
  &lt;welcome-file-list&gt;
  &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
  &lt;welcome-file&gt;index.htm&lt;/welcome-file&gt;
  &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
  &lt;welcome-file&gt;default.html&lt;/welcome-file&gt;
  &lt;welcome-file&gt;default.htm&lt;/welcome-file&gt;
  &lt;welcome-file&gt;default.jsp&lt;/welcome-file&gt;
   &lt;/welcome-file-list&gt;
  &lt;/web-app&gt;
  </code></pre>