title: how to write hello world servlet Example
body: <p>javaclass</p>
  
  <pre><code>package com.example;
  
  import java.io.*;
  import javax.servlet.*;
  import javax.servlet.http.*;
  
  // Extend HttpServlet class
  public class Helloworld extends HttpServlet {
      private String message;
  
      public void init() throws ServletException {
          // Do required initialization
          message = "Hello World";
      }
  
      public void doGet(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
          // Set response content type
          response.setContentType("text/html");
          // Actual logic goes here.
          PrintWriter out = response.getWriter();
          out.println("&lt;h1&gt;" + message + "&lt;/h1&gt;");
      }
  
      public void destroy() {
          // do nothing.
      }
  }
  </code></pre>
  
  <p>web.xml </p>
  
  <pre><code>&lt;servlet&gt;
          &lt;servlet-name&gt;HelloForm&lt;/servlet-name&gt;
          &lt;servlet-class&gt;HelloForm&lt;/servlet-class&gt;
      &lt;/servlet&gt;
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;HelloForm&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/HelloForm&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>Give is code But i run the Project  There is no Output comes 404 Error is comes in web Page . we need create Jsp Page also for servlet? I am really new in Servlet Please help how to write hello world is Servlet .</p>