1

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.

Community
  • 1
  • 1
user1785730
  • 3,150
  • 4
  • 27
  • 50

1 Answers1

2

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}"/>
user1785730
  • 3,150
  • 4
  • 27
  • 50