I have a composite component which works pretty well when used once in a page but doesn't work if I use it more than once. Let's say the component is called my:field:
<composite:implementation>
<h:form id="myForm" prependId="false">
<p:message for="inputID" display="text"/>
<p:inputText binding="#{myBean.valueBind}" id="inputID" value="#{myBean.value}" required="true" />
<p:commandButton process="@form" update="@form" action="#myBean.action} value="Do something" ajax="true"/>
</h:form>
</composite:implementation>
And I use it like this:
<my:field id="field1"/>
That works fine, but if I add this below it:
<my:field id="field2"/>
I get the following exception javax.faces.FacesException: Cannot find component "inputID" in view.
I don't understand what I am doing wrong? I've tried prepending the form id, the component id (field1) by using cc.attr.id
. I just don't know what I need to do.
I am using mojarra 2.1.13, and primefaces 3.5. Any help would be very appreciated.
Thank you.
EDIT: I added the binding=....
attribute to my p:inputText
as that is what is causing the issue but I had omitted it in my initial post.