tomahawk拡張 Tree2
TreeNodeから要素の引渡しがデキマセン!
ツリー表示をして各要素にリンクを設定し該当項目へ遷移したいわけです。
が、jspにはTreeNode型で渡しているのでそれをBeanへ渡すための設定がどーやるのやら。
リスト型なら処理の仕方わかるんだけどなあ。
日本語のドキュメント少なすぎです。
で、色々調べているうちに見つけた「現在は使わないけど今後使うかもしれない機能」をメモメモ。
画面内に複数のボタン(リンク)があり、そのボタンに応じてアクションが違う場合。
test.jsp
<h:commandButton id="mikura" actionListener="#{testBean.go}" action="御蔵深山"></h:commandButton> <h:commandButton id="amami" actionListener="#{testBean.go}" action="奄美深山"></h:commandButton> <h:commandButton id="okinawa" actionListener="#{testBean.go}" action="琉球鋸"></h:commandButton>
TestBean.java
public void go(ActionEvent event){ String island = event.getComponent().getId(); (以下略) }
これでislandにはcommandButtonの各id値("mikura","amami","okinawa")がそのまま引き渡される。
あー。島行きたい。