2011-09-13 11 views
2

JSF 1.2からリッチェス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スタイルクラスが設定されます。 JavaScriptの場合はthisです。

スコープ変数には、別の名前を付ける必要があります。 はJSFに次の予約ELオブジェクトの1つの名前は使用しないでください: - 現在UIComponent

  • #{facesContext} - 現在のFacesContext
  • #{request} - 現在のHttpServletRequest
  • #{session}

  • 0

    あなたの「コンポーネントのBeanは

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

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

    方法を必要とします。プロパティーは、Beanのフィールドで、パブリック・ゲッターとセッター・メソッドが必要です。ほとんどのIDEは、 "Source - > Generate Getter and Setter"のようなものを探すようなメソッドの生成をサポートしています。

    別の方法として、メソッドを直接呼び出す方法があります。 Beanコード

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

    と何かのように、

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

    すでにゲッター、あなたのcomponentNavigator Bean内のセッターてきた場合は、ここに掲載(またはその一部)ができれば、それは便利だろう。

    <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

    関連する問題