我使用spring3.0和sitemesh2.0。问题是无法在我的jsp页面中显示中文字符。
我做了以下
web.xml
<filter>
<filter-name>charsetFilter</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>charsetFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter>
在我的jsp中:
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
在站点网格模板中:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
站点网格.xml:
<sitemesh>
<property name="decorators-file" value="/WEB-INF/decorators.xml" />
<excludes file="${decorators-file}" />
<page-parsers>
<parser content-type="text/html"
class="com.opensymphony.module.sitemesh.parser.HTMLPageParser" />
<parser content-type="text/html;charset=UTF-8"
class="com.opensymphony.module.sitemesh.parser.HTMLPageParser" />
</page-parsers>
<decorator-mappers>
<mapper class="com.opensymphony.module.sitemesh.mapper.ConfigDecoratorMapper">
<param name="config" value="${decorators-file}" />
</mapper>
</decorator-mappers>
</sitemesh>
但是汉字仍然是这样显示的:å®å¾½çä½³å®ç©å·(éå¢)æéå¬å¸
提前致谢。