问题
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