Tomcat运行乱码通常是由于字符编码设置不正确导致的。以下是几种可能的解决方法:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
URIEncoding="UTF-8" />
<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>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
String str = new String(乱码字符串.getBytes("ISO-8859-1"), "UTF-8");
以上是一些常见的解决方法,具体应该根据你的具体情况进行调整和尝试。