Reputation: 7877
I'm creating a simple composite component with jsf2, and i'm stucked because of a stupid problem.
I don't know how to send to the composite an outcome as parameter, which will be used as action on a commandLink.
Exemple :
<!-- 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>
I have read this topic, but without success.
The only solution i've found is to use a managed-bean as redirector :
<h:commandLink action="#{redirectorBean.go(cc.attrs.myMaction)}" value="Go" />.
Someone could help me to achieve this with a better (simpler) solution ?
Thank you
Upvotes: 1
Views: 718
Reputation: 1108762
The attribute name must be action
and you need to specify the composite attribute's targets
attribute which refers the relative commandlink client ID.
Usage:
<my:comp action="myOutcome" />
Composite component:
<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>
Upvotes: 1