Reputation: 3567
I've created a custom facelets tag like this:
<ui:composition xmlns...>
<h:form>
<h:commandLink action="#{controller.doSomething()}"/>
</h:form>
</ui:composition>
And I'm trying to use it like this:
<myNs:myTag>
<ui:param name="controller" value="#{theActualController}"/>
</myNs:myTag>
But a click on the commandLink leads to the following exception:
Target Unreachable, identifier 'controller' resolved to null
This question facelets: passing bean name with ui:param to action attribute looks somewhat similar, but the solution proposed there did not work for me.
Upvotes: 1
Views: 625
Reputation: 3567
Instead of passing a parameter with ui:param, it is possible define attributes in the taglib xml file like this:
<tag>
<tag-name>myTag</tag-name>
<source>myTag.xhtml</source>
<attribute>
<name>controller</name>
<required>true</requierd>
</attribute>
</tag>
Then pass the controller like this:
<myNs:myTag controller="#{theActualController}"/>
Upvotes: 2