4 Replies Latest reply on Apr 8, 2008 5:44 AM by pete007

    Please wait message for slow servers

      Hello,


      I would like to show the user a message, that the request has been sent, but it might take a while to receive the answer.
      The simplest idea, that I found is to give all links an onClick event, that shows the message-div and when the new page is loaded, the div disapears, because it belongs the  previous page.


      So I put the div somewhere on my page and make it hidden by default in the css-file:


      <s:link view="someview.xhtml" />
      <div id="#waitawhile">please wait a while..</div>



      div#waitawhile {
        visibility: hidden;
        position: absolute;
        top:0px; left:0px;
      }



      But I have absoultely no idea, how to set the visibility-parameter to visible when clicking on the s:link in seam or where to start searching.


      Any hints are welcome, Pete

        • 1. Re: Please wait message for slow servers
          mcoffin

          If your using richfaces have a look at a4j:status.  There's an example in the richfaces demo.

          • 2. Re: Please wait message for slow servers

            Hi, thanks for your tip. I tried it, but can't get it to work, because my links look like this:


            <s:link view="/lecturesbyroom.xhtml">
             <h:graphicImage value="mainmenu_firstitem.png"/>
             <f:param name="eventDay" value="#{currentDateTime.date}"/>
            </s:link>



            And I am not sure, if it will work, when I switch from one page to another one.


            Isn't there an easier way to solve it by assigning some attribute to s:link to call a javascript function additionally, that shows up the div?

            • 3. Re: Please wait message for slow servers
              mail.micke

              Hi


              There is lots and lots of info available about this here

              • 4. Re: Please wait message for slow servers

                Okay, thanks, now I got it working. I didn't realize, that you can give the s:link a parameter onclick, sorry.


                To complete this topic, here is my solution in a nutshell:


                <s:link onclick="showBusy()" ..



                <style type="text/css">
                 #busy { visibility: hidden; }
                </style>



                <script type="text/javascript">
                 function showBusy()
                 { document.getElementById("busy").style.visibility = "visible"; }
                </script>



                <h:graphicImage value="busy.png" id="busy"/>



                I added the parameter to all s:links by a global replace, placed the image at the bottom of my main-layout and added the style- and script-sections to the main-layout. Works perfect!


                Thanks a lot, Pete