(1) Remove the tick of dynamic WEB module first
(2) Change the Java version to 1.8, click Apply
(3) Check the dynamic Web Module again, click Apply
(4) Click the further configuration available that appears below to set
Click on the right runtimes to select Tomcat installed on this computer
Click the Apply and Close button to save the settings
The error is due to the SERVELT-API can not be found, edit pom.xml
<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xsi:s chemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" > <modelversion >4.0.0</modelVersion> <groupId>com.cntaiping.tpa</groupId> <artifactid>es</ artifactid> <packaging>war</packaging> <version>0.0.1-SNAPSHOT</version> <NAME&G T;es Maven webapp</name> <url>http://maven.apache.org</url> <properties> <proje Ct.build.sourceencoding>utf-8</project.build.sourceencoding> <maven.compiler.source>1.8</
Maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties> <dependencies> <!--Https://mvnrepository.com/artifact/mysql/mysql-connector-java--> < Dependency> <groupid>mysql≪/groupid> <artifactId>mysql-connector-java</artifactId> <version>5.1.5< /version> </dependency> <!--https://mvnrepository.com/artifact/javax.servlet/javax.servlet-ap I--> <dependency> <groupId>javax.servlet</groupId> <artifactid> ;javax.servlet-api</artifactid> <version>3.1.0</version> <SCOPE>PROVIDED&L
t;/scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.9</version> <scope> test</scope> </dependency> </dependencies> <build> <finalName>es<
/finalname> </build> </project>
Note: This is not the standard structure for the default MAVEN project, we need to change
Right-click the item and select New–>source Folder
Enter Src/main/java at Folder name, click Finish button