下午好,如何使用JSF <f:ajax listener调用几个方法?
我有一个使用AJAX来呈现几个数据表而无需刷新页面搜索页面。 对于每个表格,我都必须调用Method作为侦听器。 下面是第一个可正常工作的数据表的代码片段。
要呈现第二个数据表,我需要调用方法#{evalController.prepareList}
作为ajax的侦听器。问题是<f:ajax
“听众”属性不会采取多个方法。
所以余下的方法是拨打<f:ajax
几次,每次都有一个不同的监听器,这是行不通的。有没有办法做到这一点? 如果不是,我应该在托管Bean中创建一个方法来调用我需要的所有方法并将其用作一个侦听器? 在此先感谢您的帮助。
<h:form id="searchform">
<h:panelGrid columns="3" >
<p:inputText value="#{ddnController.patientID}" id="pidinput" maxlength="7" size="7">
<f:ajax execute="@this" event="keyup" render="searchbutton ddntable" listener="#{ddnController.prepareList}"/>
</p:inputText>
<h:commandButton image="#{resource['images/search.png']}" id="searchbutton" value="#{bundle.Search}"
action="submit" actionListener="#{ddnController.prepareList}"
disabled="#{empty ddnController.patientID or ddnController.patientID.equals('0')}"/>
<p:panel><h:outputText value="Saisir 0 pour avoir tous les Patients" style="font-style: italic;"/></p:panel>
</h:panelGrid>
<p:dataTable id="ddntable" value="#{ddnController.items}" var="ddn" rendered="#{!empty ddnController.items}" paginator="true" >....
如何使用复合函数调用其中的多个其他函数。 –
所以很明显,我_almost_没有投票发表您的评论。 –
@Marcos @Steve Taylor谢谢您的意见。我问这个问题的原因是,我想确保没有办法只在视图中进行操作,而不在托管bean中游泳。 我的问题实际上是我确实创建了一个方法(函数),它调用我需要在ajax事件期间调用的所有其他函数并用作ajax监听器:public void prepareAllLists(ActionEvent event){ddrController = new DdnController(); ddnController.prepareList(); evalController = new .... evalController.prepareList(); ...... }'但它不起作用,虽然它被称为。 – Hanynowsky