Maven project created by Intellij cannot new servlet

 

cause

There is no related jar package in the maven project, so idea cannot detect it

Solution

Add the following jar package coordinates in the pom.xml maven project configuration file

<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>javax.servlet-api</artifactId>
  <version>3.1.0</version>
  <scope>provided</scope>
</dependency>

<dependency>
  <groupId>javax.servlet.jsp</groupId>
  <artifactId>jsp-api</artifactId>
  <version>2.0</version>
  <scope>provided</scope>
</dependency>

 

Finally, re-import the jar package to solve the problem

 

Guess you like

Origin blog.csdn.net/Growing_hacker/article/details/106291431