Maven does not have a servlet (an error is reported after the servlet is created)

 Maven cannot create a servlet

Solution

Scheme I

Specify the root directory in the IML of the project

 <sourceRoots>
        <root url="file://$MODULE_DIR$/src/main/java" />
  </sourceRoots>

Scheme II

Successfully solved

Error when Maven creates Servlet

Solution

Add in pom.xml (add dependencies under dependencies)

<!-- JSTL -->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>jstl</artifactId>
      <version>1.2</version>
    </dependency>
    <!-- Servlet -->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.0.1</version>
      <scope>provided</scope>
    </dependency>
    <!--JSP -->
    <dependency>
      <groupId>javax.servlet.jsp</groupId>
      <artifactId>jsp-api</artifactId>
      <version>2.1</version>
      <scope>provided</scope>
    </dependency>

Successfully resolved

 

Similar Posts: