Works now for Ouptut:
Since I'm new to JSF I was thinking valueHolder also does the binding, which is
not wanted in that case.
But the following works as intended:
<composite:interface>
<composite:attribute name="id" required="true"/>
<composite:attribute name="bean" required="true" type="a.x.Y"/>
<composite:valueHolder name="value"/>
<composite:valueHolder name="unit"/>
</composite:interface>
<composite:implementation>
<span id="#{cc.clientId}">
<h:outputText value="#{cc.attrs.bean.value}" id="value"/>
<span><h:outputText value="#{cc.attrs.bean.unit}" id="unit"/></span>
</span>
</composite:implementation>
<my:compOut id="beanId" bean="#{bean}">
<f:convertNumber pattern="#,##0.00" locale="de" for="unit"/>
</my:compOut>
---- [email protected] schrieb:
> I've already tried this, which resulted in
>
> <f:convertNumber> is nested inside a composite component but does not have a
> for attribute.
>
> I forgot to mention that I need to use JSF 2.0.
>
> Martin
>
> ---- Martin Schacherl <[email protected]> schrieb:
> > AFAIR you'll need to insert <composite:insertChildren /> in the composite
> > component instead of <f:formatNumber>. When you call your composite
> > component with a <f:convertNumber> tag as child, it gets inserted at the
> > point where <composite:insertChildren /> occurs in your composite.
> >
> > Cheers,
> > Martin
> >
> > -----Ursprüngliche Nachricht-----
> > Von: [email protected] [mailto:[email protected]]
> > Gesendet: Montag, 7. Juli 2014 13:06
> > An: [email protected]
> > Betreff: Composite with 2 outputs on 1 attribute
> >
> > I want to build a Composite handling a Bean with 2 members internally:
> >
> > Bean with Bigdecimal value and String unit
> >
> > as Attribute for the Composite:
> >
> > <composite:interface>
> > <composite:attribute name="id" required="true"/>
> > <composite:attribute name="bean" required="true" type="a.x.Y"/>
> > </composite:interface>
> >
> > <composite:implementation>
> > <span id="#{cc.clientId}">
> > <h:outputText value="#{cc.attrs.bean.value}" id="value"/>
> > <span><h:outputText value="#{cc.attrs.bean.unit}" id="unit"/></span>
> > </span>
> > </composite:implementation>
> >
> >
> > This works fine for calling it like
> >
> > <my:compOut id="beanId" bean="#{bean}"/>
> >
> > Now I want to specify formatting, which works within the Composite like
> >
> > <h:outputText value="#{cc.attrs.bean.value}" id="value">
> > <f:convertNumber pattern="#,##0.00" locale="de"/> </h:outputText>
> >
> > but I want to set it within the calling Facelet:
> >
> > <my:compOut id="beanId" bean="#{bean}">
> > <f:convertNumber pattern="#,##0.00" locale="de"/> </my:compOut>
> >
> > which does not work. I assume this is since I have no editableValueHolder
> > to refer to.
> >
> > In the following there schould be an accordingly Input implementation with
> > 2 InputTexts <my:compIn>.
> >
> > Is there any solution to this (for output and/or input) or ist that
> > combination with composites simply not possible (and must be coded in a
> > Java-Component)?
> >
> > Martin Gruschi
>