You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Paul Spencer <pa...@apache.org> on 2006/08/28 16:57:10 UTC

How to implement a "Processing, please wait..." page?

I need to implement a "Processing, please wait..." page that is 
displayed when a long query is running.  The backing bean currently has 
a method that returns "processing" or "done" to indicate the processing 
state of the query.  When "processing" is returned, the "Processing, 
please wait..." page is to be displayed for 1 second then then 
processing state will be checked again.

So how can I implement the above?


Paul Spencer

Re: How to implement a "Processing, please wait..." page?

Posted by Martin Grotzke <ma...@javakaffee.de>.
Hello Paul,

you can achieve this with ajax4jsf. Have a look at the following
postings:

question:
https://ajax4jsf.dev.java.net/servlets/ReadMsg?list=users&msgNo=829
answer:
https://ajax4jsf.dev.java.net/servlets/ReadMsg?list=users&msgNo=830
example:
https://ajax4jsf.dev.java.net/servlets/ReadMsg?list=users&msgNo=848

Cheers,
Martin


On Mon, 2006-08-28 at 10:57 -0400, Paul Spencer wrote:
> I need to implement a "Processing, please wait..." page that is 
> displayed when a long query is running.  The backing bean currently has 
> a method that returns "processing" or "done" to indicate the processing 
> state of the query.  When "processing" is returned, the "Processing, 
> please wait..." page is to be displayed for 1 second then then 
> processing state will be checked again.
> 
> So how can I implement the above?
> 
> 
> Paul Spencer


Re: How to implement a "Processing, please wait..." page?

Posted by Andrew Robinson <an...@gmail.com>.
FYI, most JSF AJAX providers include an AJAX state component that allows you
to display a "loading" or "please wait" message. a4j and AjaxAnywhere both
have one.

On 8/28/06, Simon_Lessard@dmr.ca <Si...@dmr.ca> wrote:
>
>
> Hello Paul,
>
> When I had to do this in a past project, I used ADF Faces/Trinidad's
> progressIndicator with a poll. The indicator allow you to add an action
> launched when the process terminates. So what I did was launch the long
> process on another thread and have the current request load the
> "processing..." page. The poll was then asking the server if the second
> process terminated every two seconds.
>
>
> Regards,
>
> ~ Simon
>
>
>
>
> *Jeff Bischoff <jb...@klkurz.com>*
>
> 2006-08-28 12:28
> Please respond to "MyFaces Discussion"
>
>         To:        MyFaces Discussion <us...@myfaces.apache.org>
>         cc:
>         Subject:        Re: How to implement a "Processing, please
> wait..." page?
>
>
> Paul,
>
> I recently had to implement a "please wait" page, though my requirements
> were slightly different. I was redirecting to a non-JSF page (Crystal
> Reports viewer, from the JRC in fact). Since the crystal JSP would block
> until the query was finished, I simply displayed my wait page once, and
> then immediately forwarded to the results page. The results page
> wouldn't write anything out until it was all ready, so the wait page
> stays on screen.
>
> You will doubtless need a slightly different approach, but if it helps
> any, you can take a look at what I came up with. It is based off of some
> generic JSP wait page example I found online.
>
> See attachment (assuming the attachment worked)
>
> Regards,
>
> Jeff Bischoff
> Kenneth L Kurz & Associates, Inc.
>
> Paul Spencer wrote:
> > I need to implement a "Processing, please wait..." page that is
> > displayed when a long query is running.  The backing bean currently has
> > a method that returns "processing" or "done" to indicate the processing
> > state of the query.  When "processing" is returned, the "Processing,
> > please wait..." page is to be displayed for 1 second then then
> > processing state will be checked again.
> >
> > So how can I implement the above?
> >
> >
> > Paul Spencer
> >
> >
> >
> <%@ page contentType="text/html; charset=iso-8859-1" language="java" %>
>
> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
> <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
>
> <%
>                 if ( session.getAttribute("waitPage") == null ) {
>                                  session.setAttribute("waitPage",
> Boolean.TRUE );
>                 }
>                 else {
>                                  session.removeAttribute("waitPage");
>                                  response.setContentType( "text/html" );
>                                  response.sendRedirect("
> CrystalReportViewer.jsp");
>                 }
> %>
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
> <html>
>                 <f:view>
>                                  <f:verbatim>
>                                                   <head>
>                                                                    <meta
> http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
>
>  <title>Please Wait...</title>
>                                                                    <meta
> http-equiv="Refresh" content="0">
>                                                                    <style
> type="text/css" media="screen">
>
>           #Content {
>
>                            width:343px;
>
>                            margin:0px auto; /* Right and left margin widths
> set to "auto" */
>
>                            padding:200px 0px 0px 5px;
>
>           }
>
>  </style>
>                                                   </head>
>                                                   <body>
>                                                                    <div
> id="Content">
>
>           </f:verbatim><h:graphicImage value="/pages/images/loading.gif"
> width="343" height="93" alt=""/><f:verbatim>
>                                                                    </div>
>                                                   </body>
>                                  </f:verbatim>
>                 </f:view>
> </html>
>

Re: How to implement a "Processing, please wait..." page?

Posted by Si...@DMR.CA.
Hello Paul,

When I had to do this in a past project, I used ADF Faces/Trinidad's 
progressIndicator with a poll. The indicator allow you to add an action 
launched when the process terminates. So what I did was launch the long 
process on another thread and have the current request load the 
"processing..." page. The poll was then asking the server if the second 
process terminated every two seconds.


Regards,

~ Simon





Jeff Bischoff <jb...@klkurz.com>
2006-08-28 12:28
Please respond to "MyFaces Discussion"
 
        To:     MyFaces Discussion <us...@myfaces.apache.org>
        cc: 
        Subject:        Re: How to implement a "Processing, please 
wait..." page?


Paul,

I recently had to implement a "please wait" page, though my requirements 
were slightly different. I was redirecting to a non-JSF page (Crystal 
Reports viewer, from the JRC in fact). Since the crystal JSP would block 
until the query was finished, I simply displayed my wait page once, and 
then immediately forwarded to the results page. The results page 
wouldn't write anything out until it was all ready, so the wait page 
stays on screen.

You will doubtless need a slightly different approach, but if it helps 
any, you can take a look at what I came up with. It is based off of some 
generic JSP wait page example I found online.

See attachment (assuming the attachment worked)

Regards,

Jeff Bischoff
Kenneth L Kurz & Associates, Inc.

Paul Spencer wrote:
> I need to implement a "Processing, please wait..." page that is 
> displayed when a long query is running.  The backing bean currently has 
> a method that returns "processing" or "done" to indicate the processing 
> state of the query.  When "processing" is returned, the "Processing, 
> please wait..." page is to be displayed for 1 second then then 
> processing state will be checked again.
> 
> So how can I implement the above?
> 
> 
> Paul Spencer
> 
> 
> 
<%@ page contentType="text/html; charset=iso-8859-1" language="java" %>

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>

<% 
                 if ( session.getAttribute("waitPage") == null ) {
                                 session.setAttribute("waitPage", 
Boolean.TRUE );
                 }
                 else {
                                 session.removeAttribute("waitPage");
                                 response.setContentType( "text/html" );
 response.sendRedirect("CrystalReportViewer.jsp");
                 }
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
                 <f:view>
                                 <f:verbatim>
                                                 <head>
                                                                 <meta 
http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 <title>Please Wait...</title>
                                                                 <meta 
http-equiv="Refresh" content="0">
                                                                 <style 
type="text/css" media="screen">
  #Content {
                 width:343px;
                 margin:0px auto; /* Right and left margin widths set to 
"auto" */
                 padding:200px 0px 0px 5px;
  }
                                                                 </style>
                                                 </head>
                                                 <body>
                                                                 <div 
id="Content">
  </f:verbatim><h:graphicImage value="/pages/images/loading.gif" 
width="343" height="93" alt=""/><f:verbatim>
                                                                 </div>
                                                 </body>
                                 </f:verbatim>
                 </f:view>
</html>

Re: How to implement a "Processing, please wait..." page?

Posted by Jeff Bischoff <jb...@klkurz.com>.
Paul,

I recently had to implement a "please wait" page, though my requirements 
were slightly different. I was redirecting to a non-JSF page (Crystal 
Reports viewer, from the JRC in fact). Since the crystal JSP would block 
until the query was finished, I simply displayed my wait page once, and 
then immediately forwarded to the results page. The results page 
wouldn't write anything out until it was all ready, so the wait page 
stays on screen.

You will doubtless need a slightly different approach, but if it helps 
any, you can take a look at what I came up with. It is based off of some 
generic JSP wait page example I found online.

See attachment (assuming the attachment worked)

Regards,

Jeff Bischoff
Kenneth L Kurz & Associates, Inc.

Paul Spencer wrote:
> I need to implement a "Processing, please wait..." page that is 
> displayed when a long query is running.  The backing bean currently has 
> a method that returns "processing" or "done" to indicate the processing 
> state of the query.  When "processing" is returned, the "Processing, 
> please wait..." page is to be displayed for 1 second then then 
> processing state will be checked again.
> 
> So how can I implement the above?
> 
> 
> Paul Spencer
> 
> 
>