im currently creating a JSF composite-component with a method signature that can accept parameters.
Here's the excerpt :
<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)}" fails horribly with the following error message :
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)
Is it possible to call the parameterized method from a composite-component's attribute ? I think i can deal with multiple as a workaround of working with multiple parameters in one method, but i dont like the approach, since it'll grow in size along with the parameters.
I could wrap every params into 1 wrapper object, but im still curious whether there's a way to solve the problem of calling the method with multiple params.
Please share your thoughts !
Thank you.