javascript - Calling a Stateful bean action that returns a JSF view Id in a loop to render PDFs -


is there way call stateful bean action renders pdf using jsf more once (in loop)? tried doing via javascript invoke .click() event on each button created each pdf job i'd render. xhtml looks following:

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"     xmlns:s="http://jboss.com/products/seam/taglib"     xmlns:ui="http://java.sun.com/jsf/facelets"     xmlns:f="http://java.sun.com/jsf/core"     xmlns:h="http://java.sun.com/jsf/html"     xmlns:a="http://richfaces.org/a4j"     xmlns:c="http://java.sun.com/jstl/core"     xmlns:rich="http://richfaces.org/rich">  <ui:composition>         <div id="datasizingdivgrowth">             <f:subview id="fbiadminid" rendered="#{user.fbiadmin}">                 <h:inputhidden value="#{pdfprinter.emailssize}" id="emailsizeid"/>                 <h:inputhidden value="#{pdfprinter.downloadids}" id="downloadids"/>                              <br />                 <table>                     <tr>                         <td colspan="4" align="center">                             <button type="button" onclick="savepdf();">send emails</button>                             <c:foreach items="#{pdfprinter.downloadidsarr}" var="value">                                                                 <h:form id="emailautoform-#{value}" target="_blank">                                     <h:inputhidden value="#{pdfprinter.currdownloadid}" id="currdownloadid-#{value}"/>                                     <h:commandbutton action="#{pdfprinter.emailautocd()}" id="savepdfid-#{value}" style="display:none"/>                                 </h:form>                             </c:foreach>                                                                                                                                                         </td>                     </tr>                 </table>             </f:subview>                  </div>     <script type="text/javascript">              function savepdf() {             //alert("start saving pdf");             var emailsize = document.getelementbyid("emailauto:fbiadminid:emailsizeid").value;             alert("before downloadidsarr " + emailsize);             var downloadids = document.getelementbyid("emailauto:fbiadminid:downloadids").value;             var downloadidsarr = downloadids.split("?");             //alert("before getting length");             //alert(downloadids);             //alert(downloadidsarr.length);             //alert(downloadidsarr[0]);              ( var = 0; &lt; emailsize; i++ ) {                 var j = function(x) {                     document.getelementbyid("emailauto:fbiadminid:emailautoform-" + downloadidsarr[x] + ":currdownloadid-" + downloadidsarr[x]).value = downloadidsarr[x];                                                   document.getelementbyid("emailauto:fbiadminid:emailautoform-" + downloadidsarr[x] + ":savepdfid-" + downloadidsarr[x]).click();                                  }             j(i);             }         }     </script> </ui:composition> </html> 

what happens javascript loop calls last iteration , executes , ignores before. appreciated.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -