Passing backing bean action to Facelet tag file

前端 未结 1 1461
粉色の甜心
粉色の甜心 2020-12-10 19:26

In my JSF 1.2 project, I have created a facelet tag file and defined an inputText that has actionListener attribute to which I need to pass the backing bean method name. I t

相关标签:
1条回答
  • 2020-12-10 20:23

    Passing method expressions is not supported in tag files. Only since JSF 2.0 it's possible with so-called composite components.

    What you can do is to separate the bean reference and the method name so that you can use the brace notation to invoke the method. I'm only not sure if that works out for an actionListener, you normally don't use that to invoke actions, but it should definitely work for an action.

    E.g.

    <my:tag ... bean="#{myBean}" actionMethod="preFillData" />
    

    with inside tag.xhtml

    <h:commandButton ... action="#{bean[actionMethod]}" />
    

    Only if you happen to use JSF 2.0 on Facelets, then you can use <o:methodParam> to pass a method expression to a tag file. See also a.o. Dynamic ui include and commandButton.

    0 讨论(0)
提交回复
热议问题