解决方法:
pom.xml中添加一下内容,运行:mvn tomcat7:run
,原理未知。
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<!--<url>http://localhost:8080/manager/text</url>
<server>my-tomcat</server>
<path>/myapp</path>-->
<port>8081</port>
<uriEncoding>UTF-8</uriEncoding><!-- 参数乱码 -->
</configuration>
</plugin>
常用的依赖,以免忘记
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet.jsp/javax.servlet.jsp-api -->
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.0</version>
<scope>provided</scope>
</dependency>
网友评论