Hi,
I have a strange situation because I cannot figure out why I cannot change the default validator messages.
My faces-config.xml is the following:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
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"
version="2.0">
<application>
<message-bundle>com.error.error</message-bundle>
<message-bundle>com.locale.validationerror</message-bundle>
<message-bundle>com.rules.chess.chess</message-bundle>
<message-bundle>com.help.help</message-bundle>
<resource-bundle>
<base-name>com.locale.messages</base-name>
<var>msgs</var>
</resource-bundle>
<locale-config>
<default-locale>en</default-locale>
<supported-locale>it</supported-locale>
<supported-locale>en</supported-locale>
</locale-config>
</application>
<validator>
<validator-id>captcha.validator.captchaValidator</validator-id>
<validator-class>captcha.validator.captchaValidator</validator-class>
</validator>
</faces-config>
in the file:
<myproject>/src/com/error/error_en.properties
I've put the following:
javax.faces.component.UIInput.REQUIRED=value is required
javax.faces.validator.LengthValidator.MAXIMUM=more than "{0}" characters
javax.faces.validator.LengthValidator.MINIMUM=less than "{0}" characters
javax.faces.validator.LongRangeValidator.MINIMUM=value too small
but I got
j_idt10:j_idt85:j_idt86:j_idt88:userNameInput: Validation Error: Value is required.
if I submit a form using my custom component (it does not depend on the following component, it happens always):
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml"
xmlns:ui="
http://java.sun.com/jsf/facelets"
xmlns:f="
http://java.sun.com/jsf/core"
xmlns:h="
http://java.sun.com/jsf/html"
xmlns:composite="
http://java.sun.com/jsf/composite"
xmlns:mtc="
http://java.sun.com/jsf/composite/mtc">
<composite:interface name="login" displayName="login">
<composite:attribute name="headerClass" required="false" default=""/>
<composite:attribute name="styleClass" required="false" default=""/>
</composite:interface>
<composite:implementation>
<h:outputStylesheet library="css" name="stylesheet.css" />
<mtc:panel heading="#{msgs.logintitle}"
styleClass="#{cc.attrs.styleClass}"
headerClass="#{cc.attrs.headerClass}">
<h:panelGrid id="loginbox" border="0"
columns="3"
cellpadding="5"
columnClasses="width-auto,width-50,width-50">
<h:outputLabel for="userNameInput">
<h:outputText value="#{msgs.username}:"></h:outputText>
</h:outputLabel>
<h:inputText id="userNameInput" size="20" maxlength="30" required="true" value="#{authenticationBean.loginName}">
<f:validateLength minimum="4" maximum="30"></f:validateLength>
</h:inputText>
<h:message for="userNameInput"/>
...................
please could you help understand why I got this unexpected behaviour?
[Message sent by forum member 'maxqua72']
http://forums.java.net/jive/thread.jspa?messageID=394992