English error messages in JSF 2.0.3 (not validation)?

北慕城南 提交于 2019-12-24 00:46:28

问题


I had configured JSF 1.2 successfully to display English error messages that come from the server. Now I was making the transition to JSF 2.0, but the error messages seem to be back to German. Localized error messages are a real pain if you want to google up anything (I have no idea who decided localized error messages to be a good thing BTW!).

Here's the faces-config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<faces-config version="2.0"
              xmlns="http://java.sun.com/xml/ns/javaee"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">

  <application>
    <!-- view handler only for JSF 1.2 -->
    <!--view-handler>com.sun.facelets.FaceletViewHandler</view-handler-->

    <locale-config>
      <default-locale>en</default-locale>
      <supported-locale>en</supported-locale>
      <supported-locale>en_US</supported-locale>
    </locale-config>
  </application>

</faces-config>

I'm using JSF 2.0.3 as shipped with JBAS 6, plus Seam and RichFaces.

Does anyone know how to get error messages in English language? Maybe config from the deployer or JBAS 6 itself?

Edit: the error messages appear at server startup as launched from inside Eclipse.


回答1:


The message comes from your container, not from JSF.

You can change your regional settings or add the JVM parameter -Duser.language=en when you start the container.



来源:https://stackoverflow.com/questions/6250519/english-error-messages-in-jsf-2-0-3-not-validation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!