2009-09-30 5 views
1

의 내용을 삽입 :Facelet 사용자 정의 구성 요소 - UI를 렌더링 방지 :이 내 사용자 정의 구성 요소 정의입니다 사용자 정의 구성 요소

<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> 

내가 <ui:insert name="field" />에 문제가 :

<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> 

이 내가 그것을 사용하는 방법입니다. 항상 렌더링됩니다. disabled = true 인 경우 뷰의 맨 위에 그냥 <input type="text" disabled="disabled" value="" name="itSIN" id="itSIN"/> 요소가 있습니다. 참고 : 유효성 검사기를 h : inputText에 전달하는 방법에 대한 단서가 없기 때문에 ui : insert를 사용하여 jsf 구성 요소를 전달합니다.

답변

1

내 생각에 귀하의 <c:if>은 구성 요소 트리 구축 단계에서 평가되어 중단되기 때문에 예상대로 작동하지 않습니다. this page을보십시오.

개인적으로 facelet에서 JSTL 태그를 사용하지 마십시오. 직관적이지 않은 이런 종류의 경고가 있기 때문입니다. <c:if> 대신 <ui:fragment> 또는 <h:panelGroup> 태그를 "rendered"속성을 사용하여 사용할 수 있습니다.

관련 문제