Ok, how about a second solution (slightly more useable)

        Heres my thought. You can create a bean that can persist between the
two pages using session context. Fairly simple. How about creating the
threaded bean?

        In this way, you can have one JSP page that loads data into the bean
and decides whether to show an error, or "please wait" screen. The "please
wait" screen would refresh after so long to a new page which would be in the
same session. Before the first page terminates however, it calls the beans
start() method to set it running in the background.

        In the beans run() method you put your long process, setting some
variable to show when it is finished. When your "please wait" screen
refreshes, the second jsp page can check whether the bean has completed and
if so, show the results, otherwise display the please wait screen again.

        I think this is possible, but I have never tried anything like it. I
may have a bash sometime tonight.

        Then again, my experience with threads and jsp is a bit limited.

Dave

-----Original Message-----
From: Mike Engelhart [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 17, 1999 2:47 PM
To: [EMAIL PROTECTED]
Subject: Long process (Rewrite)


Thanks for all the replies, but I don't think I posed my question in enough
detail.  While setting refresh headers certainly works for just moving to
another page, my situation is this:
I need to be able to partially process the request in a servlet before I can
tell whether or not I can continue with displaying the resulting JSP display
page (which is the page which takes a while to process).  It goes something
like this:

// get request parameters from form data, etc
RequestDispatcher rd = null;
req.setAttribute("resultBean", myBean);
setMyBeanData1()
setMyBeanData2()
if (isBeanDataCorrect())
{
   // right here is the only place I can forward to the "Please wait.." page
  // because all the data is correctly set in the bean
   callMethodWithLongProcessTime()
   rd = getServletContext().getRequestDispatcher("/jsp/finalresults.jsp");
   rd.forward(req, res);
}
else
{
    // otherwise I forward directly to the error page
    rd = getServletContext().getRequestDispatcher("/jsp/errorpage.jsp");
    rd.forward(req, res);
}

Thanks again for any help on this.

Mike
----------
>From: Colin Wilson-Salt <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: Long process
>Date: Tue, Aug 17, 1999, 1:29 AM
>

> One trick is to display a page that has a meta refresh tag that refreshes
to
> your page that does all the work, that way you get whatever 'please
wait...'
> page you want, and your other page appears when it's ready.

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
For JSP FAQ, http://www.esperanto.org.nz/jsp/jspfaq.html

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
For JSP FAQ, http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to