2017-04-18 16 views
0

我有以下代碼:JSF錯誤,同時通過方法調用在UI:PARAM

some_file.xhtml包含:

<ui:decorate template="template/a_template.xhtml"> 
    ... 
    <ui:param name="doSmthg" value="#{aBean.someAction()}"/> 
    ... 
</ui:decorate> 

而且在模板文件a_template.xhtml

<p:commandLink id="anId" actionListener="#{doSmthg}" ...> 

這裏的問題是,aBean.someAction()被正常調用,但我有一個錯誤「Identity 'doSmthg' was null and was unable to invoke「。

我沒有錯誤,如果我直接在模板中使用actionListener="#{aBean.someAction()}"

有沒有人有想法? THX

回答

0

試試這個:

的方法參數的

Passthe名稱:

<ui:param name="doSmthgName" value="someAction"/> 

,並使用它:

<p:commandLink id="anId" actionListener="#{bean[doSmthgName]}" ...>