現在、パラメーターを受け入れることができるメソッド署名を持つ JSF 複合コンポーネントを作成しています。
抜粋は次のとおりです。
<composite:interface>
....
<composite:attribute name="activateHeroMethod" method-signature="java.util.List action(id.co.sofcograha.core.Dto, id.co.sofcograha.core.Dto)" />
</composite:interface>
<composite:implementation>
....
<p:commandLink value="#{hero.map['heroName']}"
process="@this"
update="#{cc.attrs.update}"
oncomplete="infoRaceDialog.hide()"
image="ui-icon ui-icon-search">
<f:setPropertyActionListener value="#{hero}"
target="#{cc.attrs.activateHeroMethod(infoRaceBean.race, hero)}" />
</p:commandLink>
....
</composite:implementation>
target="#{cc.attrs.activateHeroMethod(infoRaceBean.race, hero)}"は、次のエラー メッセージで恐ろしく失敗します。
javax.faces.view.facelets.TagAttributeException: /resources/sofco/infoRace.xhtml @57,76 target="#{cc.attrs.activateHeroMethod(infoRaceBean.race, hero)}" /resources/sofco/infoRace.xhtml @57,76 target="#{cc.attrs.activateHeroMethod(infoRaceBean.race, hero)}" Illegal attempt to pass arguments to a composite component lookup expression (i.e. cc.attrs.[identifier]).
at com.sun.faces.facelets.tag.TagAttributeImpl.getValueExpression(TagAttributeImpl.java:401)
at com.sun.faces.facelets.tag.TagAttributeImpl.getValueExpression(TagAttributeImpl.java:351)
at com.sun.faces.facelets.tag.jsf.core.SetPropertyActionListenerHandler.applyAttachedObject(SetPropertyActionListenerHandler.java:128)
at com.sun.faces.facelets.tag.jsf.core.SetPropertyActionListenerHandler.apply(SetPropertyActionListenerHandler.java:101)
複合コンポーネントの属性からパラメータ化されたメソッドを呼び出すことは可能ですか? 1つのメソッドで複数のパラメーターを操作する回避策として複数を処理できると思いますが、パラメーターとともにサイズが大きくなるため、このアプローチは好きではありません。
すべてのパラメーターを 1 つのラッパー オブジェクトにラップすることはできますが、複数のパラメーターを使用してメソッドを呼び出す問題を解決する方法があるかどうかはまだ知りません。
あなたの考えを共有してください!
ありがとうございました。