[ 
https://issues.apache.org/jira/browse/MYFACES-2084?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12651843#action_12651843
 ] 

Roberto commented on MYFACES-2084:
----------------------------------

I debugged and tested a little more, and realized it only happens when the EL 
Expression points to a resource bundle. It works perfectly if the message is 
recovered from a managed bean.

The problem seems to be somewhere in the ELResolver. I debugged inside the 
class javax.faces.component.UIInput

    public String getValidatorMessage()
    {
        if (_validatorMessage != null)
        {
            return _validatorMessage;
        }
        ValueExpression expression = getValueExpression("validatorMessage");
        if (expression != null)
        {
            return (String) expression.getValue(getFacesContext()
                    .getELContext());
        }
        return null;
    }

As expected, _validatorMessage is null, and ValueExpression is correctly 
recovered, but 'expression.getValue(....)' is unable to determine the value and 
returns null.

I checked the expression #{text.test} is correct, because the value may be 
displayed with a h:outputText tag.

> validatorMessage does not work with EL Expressions
> --------------------------------------------------
>
>                 Key: MYFACES-2084
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2084
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 1.2.4
>         Environment: Windows XP
> Eclipse 3.4
>            Reporter: Roberto
>            Priority: Minor
>
> I am trying to show a custom message ofr Long Range validation in an input 
> text
> <h:inputText id="dos" validatorMessage="#{text.test}">
>       <f:validateLongRange minimum="1" maximum="10" />
> </h:inputText>
> , where text is the variable representing a bundle loaded with f:loadBundle
> When I use <t:messages   /> to show errors, it shows the default message 
> (paginador:dos: Validation Error: Specified attribute is not between the 
> expected values of 1 and 10.), instead of the custom one.
> The same happens when I write the property javax.faces.validator.NOT_IN_RANGE 
> in the bundle. Custom message is ignored
> Anyway, it work ok when I use a literal instead of a property inside a bundle:
> <h:inputText id="dos" validatorMessage="test message">
>       <f:validateLongRange minimum="1" maximum="10" />
> </h:inputText>
> With this code, "test message" is shown as validation error.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to