label attribute does not resolve EL expresion (JSR 252 Issue 6 related)
-----------------------------------------------------------------------
Key: MYFACES-1729
URL: https://issues.apache.org/jira/browse/MYFACES-1729
Project: MyFaces Core
Issue Type: Bug
Components: JSR-252
Affects Versions: 1.2.1-SNAPSHOT
Environment: Tomcat 6, Windows XP
Reporter: Leonardo Uribe
When validation is applied to the following page:
<%@ page session="false" contentType="text/html;charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<html>
<f:view>
<[EMAIL PROTECTED] file="inc/head.inc"%>
<body>
<f:loadBundle
basename="org.apache.myfaces.examples.resource.example_messages"
var="example_messages"/>
<h1>Myfaces Examples JSF 1.2 Additions</h1>
<h:messages id="messageList" styleClass="error"/>
<h:form id="form1">
<h:panelGrid columns="4">
<h:outputLabel for="form1:number1"
value="#{example_messages['sample1_number']} 1 :" />
<h:outputText
value="#{validationController.number1ValidationLabel}" />
<h:inputText label="#{example_messages['sample1_number']}"
id="number1" value="#{calcForm.number1}" maxlength="10"
size="25" required="true">
<f:validateLongRange minimum="1" maximum="10" />
</h:inputText>
<h:message id="number1Error" for="form1:number1"
styleClass="error" />
</h:panelGrid>
<h:panelGrid columns="4">
<h:outputLabel for="form1:number2"
value="#{example_messages['sample1_form']} 2 :" />
<h:outputText
value="#{validationController.number2ValidationLabel}" />
<h:inputText label="#{example_messages['sample1_form']}"
id="number2" value="#{calcForm.number2}" maxlength="10"
size="25" required="true">
<f:validateLongRange minimum="20" maximum="50" />
</h:inputText>
<h:message id="number2Error" for="form1:number2"
styleClass="error" />
</h:panelGrid>
<h:panelGrid columns="2">
<h:outputLabel for="form1:result"
value="#{example_messages['sample1_result']} :" />
<h:outputText id="result" value="#{calcForm.result}" />
</h:panelGrid>
<h:panelGrid columns="4">
<h:commandButton id="addButton"
value="#{example_messages['sample1_add']}" action="none">
<f:actionListener
type="org.apache.myfaces.examples.example1.CalcActionListener"></f:actionListener>
</h:commandButton>
<h:commandButton id="subtractButton"
value="#{example_messages['sample1_sub']}" action="none">
<f:actionListener
type="org.apache.myfaces.examples.example1.CalcActionListener"></f:actionListener>
</h:commandButton>
<h:commandLink id="href1" action="none">
<h:outputText
value="#{example_messages['sample1_add_link']}" />
<f:actionListener
type="org.apache.myfaces.examples.example1.CalcActionListener"></f:actionListener>
</h:commandLink>
<h:commandLink id="href2" action="none">
<h:outputText
value="#{example_messages['sample1_sub_link']}" />
<f:actionListener
type="org.apache.myfaces.examples.example1.CalcActionListener"></f:actionListener>
</h:commandLink>
</h:panelGrid>
</h:form>
</body>
</f:view>
</html>
If you use the attribute label on inputText like this:
<h:inputText label="#{example_messages['sample1_number']}"
id="number1" value="#{calcForm.number1}" maxlength="10"
size="25" required="true">
<f:validateLongRange minimum="1" maximum="10" />
</h:inputText>
and a validation error happens, the EL expression inside label attribute
returns null. On a message box this looks like:
null: Validation Error: Specified attribute is not between the expected values
of 20 and 50.
On JSF RI 1.2 this works correctly. null is replaced by the expression inside
the bundle.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.