1.在jsp页面加<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>

<%request.setCharacterEncoding("UTF-8");%>

2.配置 web.xml 时使用 ActionContextCleanUp 过滤器(Filter)

<filter>
<filter-name>struts-cleanup</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ActionContextCleanUp
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts-cleanup</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
3.在struts.properties中的编码设定:
struts.locale = UTF-8
struts.i18n.encoding = UTF-8
4.在struts.xml文件中添加 <constant name="strtus.i18n.encoding" vlaue="UTF-8" />
5.在tomcat的config文件夹下的server.xml里面的
<Connector port="8080" ....> 加上useBOdyEncodingForURI="true" disableUploadTimeout="true" URIEncoding="UTF-8" 防止url中出现乱码