myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Uribe (JIRA)" <...@myfaces.apache.org>
Subject [jira] Commented: (MYFACES-1729) label attribute does not resolve EL expresion (JSR 252 Issue 6 related)
Date Thu, 27 Sep 2007 20:57:50 GMT

    [ https://issues.apache.org/jira/browse/MYFACES-1729?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530836
] 

Leonardo Uribe commented on MYFACES-1729:
-----------------------------------------

Hi

A possible first solution should follow this two objectives:

1. Save the state of f:loadBundle on the component tree
2. Restore the state before the validation phase to make the bundle available.

I have made a simple probe. 

1. Suppose that you save the state of f:loadBundle, adding a class that extends from UIComponentBase
called
UILoadBundle, and overriding the class LoadBundleTag, extends from UIComponentELTagBase. In
simple words, make f:loadBundle a
UIComponent and not just a tag. 

2. Then I wrote a Phase Listener that after RestoreView phase check for UILoadBundle components
and restore the state adding the bundle to the RequestMap, using a algorithm that inspect
all the tree.

3. Then make a project testing how this works.

The solution works, but I have a bad feeling making f:loadBundle an UIComponent, because it's
added to the component tree.

Looking more deep, comparing JSF RI and Myfaces I have found the following conclusion:

1. f:loadBundle works very similar in both jsf implementations (It's just a tag without state).
So what's change? the WAY the messages that are
EVALUATED and RENDERED. In JSF RI, the messages are resolved on the render response phase
(so the f:loadBundle does not need state to be saved) , but in Myfaces this is done in the
process validation phase. 

Two possible courses of action:

1. Change the way the validation messages are resolved to make similar as JSF RI (on render
response phase).

2. Implement f:loadBundle with state, creating it as UIComponent, and adding a PhaseListenerLoadBundle
to restore it's particular state. 

I don't know how to do

Any suggestions? Suggestions and Expert opinions are welcome.




> 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>
> 	<%@include 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.


Mime
View raw message