在<build></build>中加入以下
<plugins>
<!-- 配置Tomcat插件 ,用于启动项目 -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<configuration>
<!-- tomcat端口-->
<port>8080</port>
<!--设置访问路径-->
<path>/web</path>
<!--设置编码 -->
<uriEncoding>UTF-8</uriEncoding>
</configuration>
</plugin>
</plugins>
在<dependencies></dependencies>加入以下
<!-- servlet 模块依赖 -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>