I have an issue with using p:outputLabel
when used with composite component. I have composite component with p:inputText
field (I removed irrelevant parts from component):
<cc:interface>
<cc:editableValueHolder name="myInput" targets="myInput"/>
<cc:attribute name="required" required="true" type="java.lang.Boolean" default="false"/>
</cc:interface>
<cc:implementation>
<p:inputText id="myInput" required="#{cc.attrs.required}"/>
</cc:implementation>
Now, I wont to use this component with p:outputLabel
:
<p:outputLabel for="myComponent:myInput" value="#{resources['myLabel']}:"/>
<my:myComponent id="myComponent" required="#{myBean.required}"/>
Everything works fine, required validation, message is displayed as well, but there is no *
sign on label, as there is when I connect label directly to p:inputText
component. If I, on the other hand, hardcode required="true"
on p:inputText
everything works fine.
I debugged through org.primefaces.component.outputlabel.OutputLabelRenderer
and discovered that component is recognized as UIInput
, but input.isRequired()
returns false. Farther debugging discovered that required
attribute isn't yet defined on component, so it returns false
as default value i UIInput
:
(Boolean) getStateHelper().eval(PropertyKeys.required, false);
Also, if I just move p:outputLabel
inside composite component everything works fine. Like EL is evaluated later inside composite component?
I'm using Primefaces 3.5 with Mojarra 2.1.14
panelGrid
, one column for label and one for input. With this it will be hard make this looks acceptable. – Bucci