Hi, this is my custom component definition:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:fn="http://java.sun.com/jsp/jstl/functions">
<c:if test="${empty required}">
<c:set var="required" value="false" />
</c:if>
<c:if test="${empty disabled}">
<c:set var="disabled" value="false" />
</c:if>
<c:if test="${not disabled}">
<div id="#{id}DIV">
<label for="#{id}" class="portlet-form-label">${label}</label>
<ui:insert name="field" />
<c:if test="${required}">*</c:if>
<strong class="portlet-msg-error" style="display: none;"><h:message for="#{id}" /></strong>
</div>
</c:if>
</ui:composition>
this is how I use it:
<my:editLineInsert id="itSIN" label="#{label['label.stocks.income']}" tip="#{label['message.default.tooltip']}" disabled="#{engine.disabled['itSIN']}" required="#{engine.required['itSIN']}" >
<ui:define name="field">
<h:inputText id="itSIN" value="#{order.income}" disabled="#{engine.disabled['itSIN']}" required="#{engine.required['itSIN']}" >
<f:converter converterId="javax.faces.BigDecimal" />
<f:validator validatorId="V12DGS6DECS" />
</h:inputText>
</ui:define>
</my:editLineInsert>
I have trouble with <ui:insert name="field" />
. It renders ALWAYS. If disabled=true I got just <input type="text" disabled="disabled" value="" name="itSIN" id="itSIN"/>
element at the top of view. NOTE: I use ui:insert to pass jsf component because I have no clue how to pass validators to an h:inputText inside custom component.