English 中文(简体)
• 如何与联合论坛一起使用几种方法?
原标题:How to call several methods with JSF <f:ajax listener?

Good Afternoon,

I have a search page that uses ajax to render a several datatables without refreshing the page. It is mandatory for me to call a Method as a Listener for each table. Below is the snippet for the first datatable that works fine.

为使第二个数据表一能够使用一种方法:#{evalController.prepareList}作为亚x的名录。 问题在于:<f:ajax> Listener"videnk ttakemore than one methods

So the remaining way is to call <f:ajax several times, and each time with a different listener, which does not work. Is there a way to achieve this? If not, should I create a method in the managed Bean that calls all the methods that I need and use it as the one listener? Thanks in advance for your help.

<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" >....
最佳回答

I am still not sure why the composite method do not have effect when called. Probably it is not called during before or after the right phase (I ll be profiling it later). Anyway, I found a solution with two edges (it is solving my problem but makes me sacrifice the use of ajax) :

因此,我不是要从每个有管理的星号中提一下我作为听众使用的方法(准备语言):

   private DataModel items = null; // Getter to retrieve items
    // ......
    public String prepareList() {
    recreatemodel();
    return "List";
    } 
private void recreatemodel(){
items=null;
}

(by the way, this method sets the datamodel to NULL to refresh it, and that is how my datatables get refreshed). Inside the command button I nested property action listener:

<h:commandButton image="#{resource[ images/search.png ]}" id="searchbutton" value="#{bundle.Search}" 
                                      action="submit" 
                                      disabled="#{empty ddnController.patientID or ddnController.patientID.equals( 0 )}">

<f:PropertyActionListener target="#{ddnController.items}" value="#{null}" />
<f:PropertyActionListener target="#{evalController.items}" value="#{null}" />
<f:PropertyActionListener target="#{corController.items}" value="#{null}" />
<!--...etc -->

</h:commandButton>

参看<f:PropertyActionListener />,可在<h:ajax/>内登出。

如果有人的解决办法允许使用property action 听器ajax/strong>,以避免以一个顿语提交表格,则欢迎他/她。 然后,我回答说是可以接受的。

问题回答

暂无回答




相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

How can i update div continuously

I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...