2011-09-13 4 views
2

JSF 1.2에서 Richfaces 3.3에서 4로 업그레이드 중입니다. JSF2 (2.02, 2.06 등)의 다양한 버전을 사용해 보았습니다. 모두 같은 오류가 발생합니다.'xxxxxx'속성이 org.richfaces.component.UIRepeat 유형에 없습니다.

몇 시간 동안 내 머리를 아프게하고있는 다음과 같은 오류가 나타납니다.

SEVERE: Error Rendering View[/my-testfile.xhtml] 
javax.el.PropertyNotFoundException: /templates/components-navigation.xhtml @31,54 rendered="#{component.allowed}": Property 'allowed' not found on type org.richfaces.component.UIRepeat 


/templates/components-navigation.xhtml

<a4j:outputPanel rendered="#{loginBean.loggedIn}"> 

    <a4j:repeat var="menugroup" value="#{componentNavigator.groups}"> 

     <a4j:region rendered="#{menugroup.itemCount > 0}"> 

      <div class="panel_menu"> 

       <table class="title" border="0" width="100%"> 
        <tr> 
        <td> 
         <h:outputText class="text" value="#{messages[menugroup.id]}" /> 
        </td> 
        </tr> 
       </table> 

       <table class="links" border="0" width="100%"> 
        <tbody> 
         <a4j:repeat var="component" value="#{componentNavigator.components}"> 


          <a4j:region rendered="#{component.allowed}"> 

           <a4j:region rendered="#{component.groupId == menugroup.id}"> 
            <tr class="#{component.current?'active':'unactive'}"> 
             <td>&nbsp;</td> 
             <td class="text" width="100%"> 
              <h:commandLink action="#{component.getCommandAction}" actionListener="#{componentNavigator.initControllerBean}">           
               <span style="display:block;"> 
                #{messages[component.id]}          
               </span> 
               <f:attribute name="controllerBean" value="#{component.controllerBean}" /> 
               <f:setPropertyActionListener target="#{componentNavigator.currentComponent}" value="#{component}" /> 
              </h:commandLink> 
             </td> 
            </tr> 
           </a4j:region> 

          </a4j:region> 

         </a4j:repeat>   
        </tbody> 
       </table> 

      </div> 

     </a4j:region> 

    </a4j:repeat> 

</a4j:outputPanel> 

라인 (31)은 다음과 같습니다

<a4j:region rendered="#{component.allowed}"> 

어떤 아이디어 속성이 발견되지 않는 이유 ? 반복 구성 요소에 대해 알려진 문제가 있습니까?

답변

1

#{component}은 현재 JSF 구성 요소를 참조하는 예약 된 암시 적 EL 개체입니다. 위의 예에서

<h:inputText value="#{bean.value}" styleClass="#{component.valid ? 'ok' : 'error'}" /> 

#{component}는 차례로 isValid() 메소드가 현재 <h:inputText>를 나타내는 UIInput 인스턴스로 확인, 다음과 같이 사용할 수있다.제출시 구성 요소에 유효성 검사 오류가 있으면 error 스타일 클래스가 설정되며 (예 : 붉은 바탕색), 그렇지 않으면 ok 스타일 클래스가 설정됩니다. 자바 스크립트에서는 this과 같습니다.

범위가 지정된 변수에 다른 이름을 지정해야합니다. JSF에서 다음 예약 EL의 개체 중 하나의 이름을 사용 하지 마십시오 :

0

귀하의 '구성 요소'빈은

public boolean getAllowed() { 
    return this.allowed; 
} 

public void setAllowed(boolean allowed) { 
    this.allowed = allowed; 
} 

방법이 필요합니다. 프로퍼티는 bean의 필드이며, public getter와 setter 메소드가 필요합니다. 대부분의 IDE는 "Source -> Generate Getter and Setter"와 같은 것을 찾는 메소드를 생성하는 것을 지원합니다.

또 다른 가능성은 메서드를 직접 호출하는 것입니다. 이미 getter와 당신의 componentNavigator 콩에서 세터 한 경우가 여기에 게시 (또는 일부) 할 수 있다면 빈 코드와 함께 뭔가 같은

<a4j:region rendered="#{component.isAllowed()}"> 

public boolean isAllowed() { 
    return this.allowed; 
} 

이 유용 할 것이다.

<a4j:repeat var="component" value="#{componentNavigator.components}"> 

에 :

리처드

+0

나는 이미 내 빈에서 내 게터/세터, 모든 것이 아니오 (JSF1.2에서 완벽하게 작동있어 콩에 대한 변경 사항). 그것은 내 var로 '구성 요소'라는 단어를 사용하는 것과 관련이있을 것 같습니다. –

0

나는 변경

<a4j:repeat var="myComponent" value="#{componentNavigator.components}"> 

와 지금은 모든 좋은 :)

내가 나에게 단서를 준이 문제를 우연히 발견했다 :

https://issues.jboss.org/browse/RF-8026

관련 문제