title: HTTP Status 404 - Not Found
body: <p><strong>filter</strong></p>
  
  <pre><code>import java.io.IOException;  
  import java.io.PrintWriter;  
  
  import javax.servlet.*;  
  
  public class MyFilter implements Filter{  
  
  @Override
  public void init(FilterConfig arg0) throws ServletException {}  
  
  @Override
  public void doFilter(ServletRequest req, ServletResponse resp,  
      FilterChain chain) throws IOException, ServletException {  
  
      PrintWriter out=resp.getWriter();  
      out.print("filter is invoked before");  
  
      chain.doFilter(req, resp);//sends request to next resource  
  
      out.print("filter is invoked after");  
      }  
      public void destroy() {}  
  }  
  </code></pre>
  
  <p><strong>servlet</strong></p>
  
  <pre><code>import java.io.IOException;  
  import java.io.PrintWriter;  
  
  import javax.servlet.ServletException;  
  import javax.servlet.http.*;  
  
  public class HelloServlet extends HttpServlet {  
      @Override
      public void doGet(HttpServletRequest request, HttpServletResponse response)  
              throws ServletException, IOException {  
  
          response.setContentType("text/html");  
          PrintWriter out = response.getWriter();  
  
          out.print("&lt;br&gt;welcome to servlet&lt;br&gt;");  
  
      }  
  
  }  
  </code></pre>
  
  <p><strong>web.xml</strong></p>
  
  <pre><code>&lt;web-app&gt;  
  
  &lt;servlet&gt;  
   &lt;servlet-name&gt;HelloServlet&lt;/servlet-name&gt;  
   &lt;servlet-class&gt;HelloServlet&lt;/servlet-class&gt;  
  &lt;/servlet&gt;  
  
  &lt;servlet-mapping&gt;  
   &lt;servlet-name&gt;HelloServlet&lt;/servlet-name&gt;  
   &lt;url-pattern&gt;/HelloServlet&lt;/url-pattern&gt;  
  &lt;/servlet-mapping&gt;  
  
  &lt;filter&gt;  
   &lt;filter-name&gt;MyFilter&lt;/filter-name&gt;  
   &lt;filter-class&gt;MyFilter&lt;/filter-class&gt;  
  &lt;/filter&gt;  
  
  &lt;filter-mapping&gt;  
   &lt;filter-name&gt;MyFilter&lt;/filter-name&gt;  
   &lt;url-pattern&gt;/servlet1&lt;/url-pattern&gt;  
  &lt;/filter-mapping&gt;  
  
  
  &lt;/web-app&gt;  
  </code></pre>
  
  <p><strong>index.html</strong></p>
  
  <pre><code>     &lt;a href="servlet1"&gt;click here&lt;/a&gt;  
  </code></pre>
  
  <p>error is :  </p>
  
  <p><strong>HTTP Status 404 - Not Found</strong></p>
  
  <p>type Status report</p>
  
  <p>messageNot Found</p>
  
  <p>descriptionThe requested resource is not available.
  GlassFish Server Open Source Edition 4.0 </p>
  
  <p>I have given entire code plz help me find my error 
  in am new to sevlet
  question may sound dumb but plz help me</p>