1

私は jsf2 で単純な複合コンポーネントを作成していますが、愚かな問題のために立ち往生しています。

commandLink のアクションとして使用されるパラメーターとして結果をコンポジットに送信する方法がわかりません。

例:

<!-- Usage -->
<my:comp myAction="myOutcome" />

<!-- Component -->
<composite:interface>
    <composite:attribute name="myAction" required="true" />
</composite:interface>

<composite:implementation>
    <h:form>
        <h:commandLink action="#{cc.attrs.myAction}" value="Go" />
    </h:form>
</composite:implementation>

<!-- Expected result -->
<h:form><h:commandLink action="myOutcome" value="Go" /></h:form>

このトピックを読みましたが、成功しませんでした。

私が見つけた唯一の解決策は、マネージドBeanをリダイレクタとして使用することです:

<h:commandLink action="#{redirectorBean.go(cc.attrs.myMaction)}" value="Go" />.

誰かがより良い(より簡単な)解決策でこれを達成するのを手伝ってくれますか?

ありがとうございました

4

1 に答える 1

1

属性名は必須であり、相対コマンドリンク クライアント ID を参照する複合属性の属性を指定する必要がありますactiontargets

使用法:

<my:comp action="myOutcome" />

複合コンポーネント:

<composite:interface>
    <composite:attribute name="action" targets="form:go" required="true" />
</composite:interface>

<composite:implementation>
    <h:form id="form">
        <h:commandLink id="go" value="Go" />
    </h:form>
</composite:implementation>
于 2011-08-01T17:59:24.127 に答える