2012-03-24 63 views
0

我有一个网站应该以两种语言显示:Eng和Ru。 它是Tomcat6,Java6,Spring3,Tiles2。 网站确实以两种语言显示文字。但是,如果出现错误(并且我设置了自定义错误页面),则俄语文本中的错误页面显示为????????? (一堆?)西里尔文本不会显示在错误页面上

该文本在属性文件中。认为普通文本在一个文件中,错误消息在另一个文件中。我选中 - 两个文件都使用相同的编码进行保存。

在我的web.xml

我有这样的:

<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> 
    <filter-mapping> 
     <filter-name>encodingFilter</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping> 

和错误页面是在web.xml中定义为:

<error-page> 
    <error-code>400</error-code> 
    <location>/Exception</location> 
</error-page> 

<error-page> 
    <error-code>403</error-code> 
    <location>/Exception</location> 
</error-page> 

<error-page> 
    <error-code>404</error-code> 
    <location>/404</location> 
</error-page> 

<error-page> 
    <error-code>500</error-code> 
    <location>/Exception</location> 
</error-page> 

<error-page> 
    <error-code>503</error-code> 
    <location>/Exception</location> 
</error-page> 

<error-page> 
    <exception-type>java.lang.Exception</exception-type> 
    <location>/Exception</location> 
</error-page> 
在对myApp-servlet.xml中

我确实有这个

<bean id="messageSource" 
     class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> 
     <!-- <property name="basename" value="classpath:text" /> --> 

     <property name="basenames"> 
      <list> 
       <value>classpath:text</value> 
       <value>classpath:errors</value> 
      </list> 
     </property> 
     <property name="defaultEncoding" value="UTF-8" /> 
     <property name="fileEncodings" value="UTF-8" /> 
    </bean> 

再次,整个网站确实显示俄文文本。这是错误页面没有。

是否有需要为错误页面指定的独立设置?或者我错过了什么?

+0

当你得到的错误页面,你可以右键点击你的浏览器,并确认编码是UTF-8? – 2012-03-24 22:05:52

回答

1

过滤器映射中有一个名为调度器的参数。您应该添加以下到您的过滤器映射:

<dispatcher>REQUEST</dispatcher> 
<dispatcher>ERROR</dispatcher> 
+0

是的!就是这样!它确实有效。 – Pinny 2012-03-26 14:46:23