jeesite jeesite.properties 中文乱码怎么解决
1个回答
展开全部
1. 确认工程编码是UTF-8
右击工程名,单击properties,单击Resource,把Text file encoding设置为UTF-8
2. 确认工作空间为UTF-8
单击windows->General->Workspace,把Text file encoding设置为UTF-8
3. 将jsp请求设置为UTF-8
在页头添加<%@page contentType="text/html; charset=UTF-8" %>
4. 将jsp响应设置为UTF-8
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
5. 如果还有乱码则在struts.xml中设置中文字符集:
<constant name="struts.i18n.encoding" value="utf-8"></constant>
6. 如果还有乱码,在web.xml中添加中文过滤器:
<filter>
<filter-name>CharacterEncoding</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>
<filter-mapping>
<filter-name>CharacterEncoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
7. 如果还有乱码,在Action中的response字符集设置为UTF-8:
ServletActionContext.getResponse.setCharacterEncoding("utf-8");
8. 如果还有乱码,则将服务器跳转配置设置为UTF-8:
resin服务器的设置如下,修改conf目录下的resin.conf:
<web-app id='/' document-directory="E:\WorkSpace\StrutsDemo\WebRoot">
<character-encoding>utf-8</character-encoding> <!--指定字符集编码-->
<work-dir>D:/tools/resin-3.0.22/work</work-dir> <!--指定work工作目录-->
<temp-dir>D:/tools/resin-3.0.22/temp</temp-dir> <!--指定临时工作目录-->
</web-app>
tomcat服务器设置如下,修改conf目录下的server.xml:
<Connector port="80" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="UTF-8"/>
右击工程名,单击properties,单击Resource,把Text file encoding设置为UTF-8
2. 确认工作空间为UTF-8
单击windows->General->Workspace,把Text file encoding设置为UTF-8
3. 将jsp请求设置为UTF-8
在页头添加<%@page contentType="text/html; charset=UTF-8" %>
4. 将jsp响应设置为UTF-8
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
5. 如果还有乱码则在struts.xml中设置中文字符集:
<constant name="struts.i18n.encoding" value="utf-8"></constant>
6. 如果还有乱码,在web.xml中添加中文过滤器:
<filter>
<filter-name>CharacterEncoding</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>
<filter-mapping>
<filter-name>CharacterEncoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
7. 如果还有乱码,在Action中的response字符集设置为UTF-8:
ServletActionContext.getResponse.setCharacterEncoding("utf-8");
8. 如果还有乱码,则将服务器跳转配置设置为UTF-8:
resin服务器的设置如下,修改conf目录下的resin.conf:
<web-app id='/' document-directory="E:\WorkSpace\StrutsDemo\WebRoot">
<character-encoding>utf-8</character-encoding> <!--指定字符集编码-->
<work-dir>D:/tools/resin-3.0.22/work</work-dir> <!--指定work工作目录-->
<temp-dir>D:/tools/resin-3.0.22/temp</temp-dir> <!--指定临时工作目录-->
</web-app>
tomcat服务器设置如下,修改conf目录下的server.xml:
<Connector port="80" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="UTF-8"/>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询