You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by pb...@gmx.net on 2008/10/23 02:35:56 UTC

Redirect/forward after longer background operation

Hi all,

I'm working on a dialog/wizard style web page: a couple of forms to gather data from the user, then a longer process that calculates some MD5 sums and a final page showing the result of the operation.

I'm wondering what the best way would be to indicate to the user that an operation is running in the background and also automatically showing the result, once complete.

Ideally I would put an icon/progress bar on the page while the background process on the server calculates the MD5 sums (in my example) and would need to automatically redirect the page once that's done.

I'd like to avoid extensive AJAX/JavaScript if possible. One idea I had was to show a page with a progress bar that takes the id of the background process as GET parameter and refreshes every 2 seconds. Based on the id I can determine the status of the background operation and send a final redirect once that's done. Seems a bit cumbersome, though...

Any ideas/suggestions would be appreciated.

Thanks,
Rico.
-- 
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail

Re: Redirect/forward after longer background operation

Posted by Ricardo Lecheta <rl...@gmail.com>.
Hi,

You can reload the page after 2 seconds as you said.. and check if your
background/thread process have already done its job..
To do this you can use a Thread, and save this "id" or "token" to identify
that process.

or...

If you prefer you can use a Quartz Job to run your task in background... The
job can insert some data in some table in the database to tell your Page
that this job have finished successfully. And after that, the Page checks
every 2 seconds, for this data in the table... you can use the same "id" in
the first scenario...

I like the second option...

but for example WebWork2/Struts2 has the ExecuteAndWaitInterceptor  that
implements the first option
http://www.opensymphony.com/webwork/wikidocs/Execute%20and%20Wait%20Interceptor.html

regards,
Ricardo


On Wed, Oct 22, 2008 at 10:35 PM, <pb...@gmx.net> wrote:

> Hi all,
>
> I'm working on a dialog/wizard style web page: a couple of forms to gather
> data from the user, then a longer process that calculates some MD5 sums and
> a final page showing the result of the operation.
>
> I'm wondering what the best way would be to indicate to the user that an
> operation is running in the background and also automatically showing the
> result, once complete.
>
> Ideally I would put an icon/progress bar on the page while the background
> process on the server calculates the MD5 sums (in my example) and would need
> to automatically redirect the page once that's done.
>
> I'd like to avoid extensive AJAX/JavaScript if possible. One idea I had was
> to show a page with a progress bar that takes the id of the background
> process as GET parameter and refreshes every 2 seconds. Based on the id I
> can determine the status of the background operation and send a final
> redirect once that's done. Seems a bit cumbersome, though...
>
> Any ideas/suggestions would be appreciated.
>
> Thanks,
> Rico.
> --
> "Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
> Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
>



-- 
Ricardo Lecheta