myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Uribe (JIRA)" <>
Subject [jira] [Commented] (MYFACES-4059) InputValueHolder not required while defined as such in composite
Date Thu, 18 Aug 2016 01:41:20 GMT


Leonardo Uribe commented on MYFACES-4059:

I have checked the example and now I see what's going on. Thanks for provide 
the example, this is something a bit tricky to understand, because at first 
view it looks like a bug but later you realize it is not.

The problem start with the use of findComponent. This method comes from 
JSF 1.0 and was designed to work inside the current NamingContainer. The 
problem is the outputLabel component is outside the context where the EL 
expression is valid. So, when isRequired() is evaluated, since the 
expression is not evaluated inside the composite component, JSF cannot get 
the right instance. Then, the EL expression return null and the coercion 
rules finally return false. 

Is valid to use findComponent for h:outputLabel? yes, and the reason is 
that the only thing you need in that case is to get the clientId, so the 
spec is ok.

But p:outputLabel try to get some info from the component (isRequired()) 
without set the context first. One way to make it work (setting the
context) is use invokeOnComponent to get the attribute (but you need 
the clientId, so first call findComponent and then use invokeOnComponent
over the clientId, but from the parent NamingContainer), so the 
relative expression could find the right instance.

>From spec perspective there is nothing to do. First of all, JSF 2 
composite component aims to encapsulate everything inside a composite 
component, so the call is invalid from the beginning, because it is 
assumed something from inside the composite content.

In any case, the fix should be done in primefaces, but it is questionable
to do it, because the syntax is invalid anyway. There is nothing else
to do from myfaces side, so again I'll close this issue as invalid.

> InputValueHolder not required while defined as such in composite
> ----------------------------------------------------------------
>                 Key: MYFACES-4059
>                 URL:
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.2.10
>            Reporter: Rapster
>            Assignee: Leonardo Uribe
>         Attachments: jsf-bug-required-composite.7z
> In a very simple way, here is a composite:
> {code}
> <ui:component 
>     xmlns=""
>     xmlns:f=""
>     xmlns:h=""
>     xmlns:cc=""
>     xmlns:ui=""
>     xmlns:c=""
>     xmlns:fn=""
>     xmlns:p=""
> >
>     <cc:interface>
>         <cc:attribute name="value" />
>         <cc:attribute name="required" />
>     </cc:interface>
>     <cc:implementation>
>         <p:calendar id="calendar" value="#{cc.attrs.value}" required="#{cc.attrs.required}"
>     </cc:implementation>
> </ui:component>
> {code}
> Here how I use it:
> {code}
> <p:outputLabel for="rat:calendar" value="Hello" />
> <my:calendar id="rat" required="true"/>
> {code}
> A required=true icon should be displayed but it does not. In OutputLabelRenderer looks
fine, except in line 118, input.isRequired() returns false while I explicitly set true. It
is not related to Primefaces but looks like a JSF impl problem (I'm using Myfaces 2.2.10)

This message was sent by Atlassian JIRA

View raw message