6 Replies Latest reply on Aug 19, 2009 7:36 PM by jguglielmin

    Seam Please Wait ...

    nicevision2020

      Hello Everyone...


      I have a seam s:link which invoke a backing bean.  In the bean i am generating excel using seam excel and facelets. Before the user get the downloading dialog box i like to give information about the processing..  Like please wait or loading..  At the end of the backing bean method i.e after the xls file streaming out to the browser i am call this


      FacesContext.getCurrentInstance().renderResponse();


      I added onclick event to show the div and later i thought facescontext will take care of the closing the div (reloading the page).  But its not happening.  So the div never closed.


      Is there is any way to do this.  I am using icefaces.


      Thanks

        • 1. Re: Seam Please Wait ...
          asookazian

          In RichFaces we use rich:modalPanel and a4j:status.  Works great.


          <rich:modalPanel id="mpWait" 
                                    style="text-align:center"
                                    height="100"
                                    width="150">
                    <h:form>
                         <h:panelGrid>
                              <h:outputText value="Please wait..."
                                               style="font-weight:bold;font-size:large"/>
                              <rich:spacer height="20"/>
                              <h:graphicImage value="/img/spinner.gif"/>
                         </h:panelGrid>
                    </h:form>
               </rich:modalPanel>
                
               <a4j:status id="actionStatus"
                       onstart="Richfaces.showModalPanel('mpWait')"
                       onstop="Richfaces.hideModalPanel('mpWait')"/>

          • 2. Re: Seam Please Wait ...
            kiekie96

            Hi Arbi how do you link s:link or h:commandbutton to a4j:status ? so where link or button onclick, the modal panel showed up and when the process on backing bean finished modal panel hide automatically?

            • 3. Re: Seam Please Wait ...
              nicevision2020

              I did some sample it works for form but not for s:link.  It throws an error A4J ...


              If i am not wrong, I think A4J status works only for the form.  I did the A4J region.  But the status doesnt work.

              • 4. Re: Seam Please Wait ...
                asookazian

                Kiekie Loebiz wrote on Aug 14, 2009 11:27:


                Hi Arbi how do you link s:link or h:commandbutton to a4j:status ? so where link or button onclick, the modal panel showed up and when the process on backing bean finished modal panel hide automatically?


                You do not link it to the a4j:status.  The a4j:status onstart and onstop events are processed when there is an AJAX request/response cycle.  So that means you need to use a4j:commandButton to submit your form rather than h:commandButton. 


                What I do is add the above xhtml code to a separate facelet and then include that facelet in every JSF page (facelet) that needs that functionality.  It should work automatically with no additional wiring.


                Read more about this solution in Practical RichFaces book.

                • 5. Re: Seam Please Wait ...
                  nicevision2020

                  Thanks for your reply. I will try...

                  • 6. Re: Seam Please Wait ...
                    jguglielmin

                    As for ICEfaces...the simplest solution is to use the outputResource component to handle the download and the outputProgress to show that something is going on during the request.  If you want a progress bar/message while the file is being readied, that would probably involve a bit more complexity and I would suggest posting to the ICEfaces forum with request for ideas/examples.  This might be something to add to the outputResource component (similar to the inputFile component which has the option to use the progressMonitor component with it) and you could possibly open a jira for this enhancement.