4 Replies Latest reply on Oct 28, 2009 9:23 AM by Silvestre Losada

    a4j:JSfunction a4j:coomandButton different different behavio

    Silvestre Losada Newbie

      Hi all,
      The richfaces documentation says that in documentation says that it's possible to use <a4j:jsFunction> instead of <a4j:commandButton>, but it is not working for me.
      I'm invoking an actionListener using a4j:commandButton, the action do a search and prints the number of results, works fine. Currently I want to use a4j:JSfunction to invoke the same action, the action is invoked and the search is done properly, however results display 0 elements found, I'm debbuging at server and results are found. The action invoked is the same in both cases,
      Here is my code
      jsp page

      <?xml version="1.0" encoding="iso-8859-1" ?>
      <jsp:root version="1.2" xmlns:jsp="http://java.sun.com/JSP/Page"
       <jsp:directive.page contentType="text/html;charset=iso-8859-1"
       pageEncoding="iso-8859-1" />
       <html lang="es">
       <a4j:form id="formulario">
       function search(){
       updateGraph(); }
       <h:inputText id="content"
       <a4j:jsFunction name="updateGraph" actionListener="#{interfaceContainer.documentFormActions.search}" >
       <a4j:commandButton type="submit" tabindex="80"
       title="buscar" value="Buscara4j" id="Submit" actionListener="#{interfaceContainer.documentFormActions.search}" />
       <h:commandButton tabindex="80" title="update"
       id="updateGrgg" value="graph" onclick="javascript:search();" />
       <h:outputText id="info2"
       value="Empty #{not empty searchResults} number #{searchResults.numFound } " />

      The beans scope of the beans is request, and the action is
       public void search(ActionEvent e) {
       FacesContext context = FacesContext.getCurrentInstance();
       SearchResults searchResults = (SearchResults) context.getELContext()
       .getELResolver().getValue(context.getELContext(), null,
       QResponse qresponse = solrConnector.executeSearch();
       processSearch(qresponse, searchResults);
       .getELResolver().setValue(context.getELContext(), null,