title: Create a servlet in VScode maven project
body: <p>I have created a maven-archetype-webapp in VScode and created a folder Servlets in src/main/. This folder Servlets contain servlets. And I have also added tomcat server but when I am trying to run this server error -
  <em><strong>[Tomcat 9.0]: 'C:\Program' is not recognized as an internal or external command,
  operable program or batch file</strong></em> is keep coming on console.</p>
  <p>Also when I try to run the project with tomcat server it is showing - <strong>this folder is not a valid webapp</strong></p>
  <p>[![It is the tree structure of my project][1]][1]
  [1]: https://i.stack.imgur.com/YPV3K.png</p>
  <p>Code of FirstServlet.java -</p>
  <pre class="lang-java prettyprint-override"><code>import javax.servlet.http.HttpServlet;
  
  import java.io.IOException;
  import java.io.PrintWriter;
  
  import javax.servlet.*;
  import javax.servlet.http.*;
  
  public class FirstServlet extends HttpServlet{
      public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException  {
          
          System.out.println(&quot;this is get method....&quot;);
          res.setContentType(&quot;text/html&quot;);
          PrintWriter out = res.getWriter();
          out.println(&quot;&lt;h1&gt; this is get method of servlet&lt;/h2&gt;&quot;);
          
          
      }
  
  }
  
  </code></pre>
  <p>This is my web.xml file -</p>
  <pre><code>&lt;!DOCTYPE web-app PUBLIC &quot;-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN&quot; &quot;http://java.sun.com/dtd/web-app_2_3.dtd&quot;&gt;
  
  &lt;web-app&gt;
    &lt;display-name&gt;Archetype Created Web Application&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;servlet&gt;
      &lt;servlet-name&gt;first&lt;/servlet-name&gt;
      &lt;servlet-class&gt;FirstServlet&lt;/servlet-class&gt;
    &lt;/servlet&gt;
  
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;first&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/first&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  
  &lt;/web-app&gt;
  
  </code></pre>
  <p><strong>In this file, web-app tag is showing a red line with error message</strong> -
  The web-app element is the root of the deployment descriptor for a web application.</p>
  <p>Source: web-app_2_3.dtd</p>
  <p>The content of element type &quot;web-app&quot; must match &quot;(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)&quot;.xml(MSG_CONTENT_INVALID)</p>