2013-10-12 3 views
0
<ui:repeat value="#{prodCtr.paginator.model}" var="o">      
       <h:form> 
        <h:commandLink id="#{o.id}" action="ModelInfo.xhtml" actionListener="#{prodCtr.listener}">       
         <h:panelGrid columns="1" style="border: #ffffff"> 
          <img src="resources/images/#{o.id}.jpg" style="width: 100px;height: 100px"/>        
          <h:outputLabel value="#{o.price} YTL" style="font-size: 12px;font-family: Georgia, Serif;color: #ff3300" /> 
          <h:commandButton value="Sifaris et" class="button"/> 
         </h:panelGrid> 
        </h:commandLink>         
       </h:form> 

     </ui:repeat> 

java.lang.IllegalArgumentException가 : UIComponent로부터 된 ClientID = 메시지 = 빈 id 속성은 여기에 허용되지 않습니다컨트롤러에서 CommandLink id를 JSF로 클릭하는 방법은 무엇입니까? RENDER_RESPONSE 6의 처리 중에 잡은

난 dinamically ID를 CommandLink는 할 수있는 다른 방법이 있나요 어떻게

? <ui:repeat/> 태그를 사용할 때

답변

0
  1. 당신은 하위 구성 요소에 대한 id 속성을 지정 필요하지 않습니다. 자동으로이 작업을 수행합니다.

  2. id 특성을 제어하려는 경우 <ui:repeat/>은 잘못된 방법입니다. 그 이유는 구성 요소가 UIViewroot에있는 시점 (본질적으로 페이지가 처음 구성 될 때)에 <ui:repeat/> 구성 요소가 활성화되지 않았기 때문입니다. 즉, 처리되지 않습니다. 따라서 var="o"은 런타임에서 사용할 수 없으므로 id으로 사용할 수있는 것이 없습니다.

    id을 제어하려면 <c:forEach/> 태그를 사용해야합니다. 코드는 다음과 같이 표시되어야합니다.

    <c:forEach items="#{prodCtr.paginator.model}" var="o"> 
         <h:form> 
          <h:commandLink id="#{o.id}" action="ModelInfo.xhtml" actionListener="#{prodCtr.listener}">       
           <h:panelGrid columns="1" style="border: #ffffff"> 
            <img src="resources/images/#{o.id}.jpg" style="width: 100px;height: 100px"/>        
            <h:outputLabel value="#{o.price} YTL" style="font-size: 12px;font-family: Georgia, Serif;color: #ff3300" /> 
            <h:commandButton value="Sifaris et" class="button"/> 
           </h:panelGrid> 
          </h:commandLink>         
         </h:form> 
    
    </c:forEach>