You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Roberto (JIRA)" <de...@myfaces.apache.org> on 2008/11/30 05:43:44 UTC

[jira] Created: (MYFACES-2084) validatorMessage does not work with EL Expressions

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.


[jira] Commented: (MYFACES-2084) validatorMessage does not work with EL Expressions

Posted by "Roberto (JIRA)" <de...@myfaces.apache.org>.
    [ 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.


[jira] Commented: (MYFACES-2084) validatorMessage does not work with EL Expressions

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2084?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12710145#action_12710145 ] 

Leonardo Uribe commented on MYFACES-2084:
-----------------------------------------

Maybe if you try to load the bundle using:

<application>
<resource-bundle>
<base-name>
your.bundle.name
</base-name>
<var>bundle</var>
</resource-bundle>
</application>

on your faces-config.xml, the bundle can be evaluated. If you are using f:loadBundle, this error could happen, because f:loadBundle add the reference on render response time.

This will be closed as won't fix, because in fact f:loadBundle has this unwanted behavior. Note that it is possible to use tomahawk sandbox s:loadBundle to solve this problem.


> 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.5
>         Environment: Windows XP
> Eclipse 3.4
>            Reporter: Roberto
>
> 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.


[jira] Commented: (MYFACES-2084) validatorMessage does not work with EL Expressions

Posted by "Roberto (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2084?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12651831#action_12651831 ] 

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

I realized that I should use javax.faces.validator.LongRangeValidator.NOT_IN_RANGE instead of javax.faces.validator.NOT_IN_RANGE, and that part works ok. Anywat, it continues failing when I use an EL Expression on validatorMessage

> 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.