项目从jetty服务器换tomcat乱码

项目在jetty下正常,换tomcat下出现乱码。
经检查问题是web.xml中的encodingFilter不是第一个,要设置为
第一个
<!-- start encodingFilter -->
	<filter>
		<filter-name>encodingFilter</filter-name>
		<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
		<init-param>
			<param-name>encoding</param-name>
			<param-value>UTF-8</param-value>
		</init-param>
		<init-param>
			<param-name>forceEncoding</param-name>
			<param-value>true</param-value>
		</init-param>
	</filter>
	<!-- start encoding Filter mapping -->
	<filter-mapping>
		<filter-name>encodingFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	<!-- end encodingFilter -->

你可能感兴趣的:(tomcat,乱码,java乱码)