1

<button>タグを出力する複合コンポーネントを作成したい。このタグは他のコンテンツをラップします。1 つのオプションは、独自のコンポーネントとレンダラーを作成することです。しかし、私はそれを複合的に行うことを好みます。<button>私が予測できる唯一の問題は、タグがクリックされたときのアクションを指定することです。

カスタムコンポジットでアクションを指定できるかどうか知っている人はいますか?

4

1 に答える 1

1

When defining composite components, you can specify that your component is action source:

<cc:interface>
  <!-- ... -->
  <cc:actionSource name="myButton" targets="myButton"/>
  <!-- ... -->
</cc:interface>

<cc:implementation>
  <!-- ... -->
  <h:commandButton id="myButton" value="My Button"/>
  <!-- ... -->
</cc:implementation>

With this, you made your composite component action source, and you can define action listeners in your component:

<my:customComponent id="component">
  <f:actionListener for="myButton" binding="#{myBean.action}"/>
</my:customComponent>
于 2013-02-17T16:36:28.333 に答える