1.在pom.xml中加入代码
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
项目(右键)-->build path--->Configure Build Path--->Libraries--->Add Library--->Server Runtime--->选中添加的tomcat--->finished