While processing....

Jens

New Member
Hi,

(crossposted in the psdn forum)

My problem: I have a WebSpeed app where a request from one page (page A) to another page (page B) takes lots of time (normally 10-40 seconds sometimes longer). This is because of communication with an external system so I have no real option of speeding it up. While this page is loading the browser displays a white blank page and this isn't very good. What I would like to do is to display a page while processing that says: "Please stand by your request is being processed" or similar.
Facts: OE 10.1 A, Apache Webserver 1.3.x, Sun Solaris 10.

I have 3 ideas:

1) Create a middle page, post from page A to this middle page. Place a META HTTP-EQUIV="REFRESH" tag in this page and direct it to page B. It will cause the browser to display the middle page while loading page B. The problem is that it breaks the default behavior of the browser making the Back button from page B behaving in a wait you wouldnt expect.

2) This one is a bit trickier. It would require one or two new tables in the database. One storing request data and one storing request responses. On loading page "B" I create a record with the request data then I spawn a background process that starts working with this request. The background process writes the response from the external service either in the second table (or possibly in a file on disk). Meanwhile page "B" reloads every other second checking the post to see if the request is done. If it is so it reads data from the second table and displays it. Otherwise it just shows the waiting message again. This feels like a more professional solution but it would require quite much work.

3) This solution is a bit more vague. It's basically solution number 2 but instead of creating a record in a request table page B does an async appserver call and thus starts the request. Then it somehow checks back with the appserver every other second to see if it is done and then reads the response either from a table or from a disk on file. Since I haven't worked with async appserver calls I'm not 100% sure it would work but it's a thought anway.

Does anyone have any comments to this or perhaps other ideas? All input is greatly appreciated. I really think there should be an easier way of doing it without breaking any usability rules (as in solution number 1).

Best regards
Jens Dahlin
Airtours
 

a.vermeulen

New Member
I see two ways:
1. ajax
2. some css and a webspeed trick.

1. Create a page displaying some text within a DIV:
<DIV id=sometext>Some text asking the user for patience</DIV>
Then within the page get some HTML throug Ajax from your webspeed server and then change the innerHTML of the DIV with id=sometext.

2. Create a page also display some text, but now within a table.
Then put this in your webspeed program:
PUT {&WEBSTREAM} CONTROL NULL(0).
WebSpeed fills a buffer with text from the program, when the buffer is full it will be send to the user. This line will cause WebSpeed to dump the buffer (half full) to the user.
So the user has is message on screen, the same program is building up the remainder of the schreen.
Now put in some javascript / css with the onload of the body to hide the table/row with the textline in it.

Regards,
Alexander
 

Jens

New Member
Hi Alexander,

I don't think Ajax is the solution since I think it will be about as easy to do a re-write like in solution number 2 - I have no Ajax experience what so ever.

I've looked into that webspeed trick earlier and found out that it really doesn't work. In Internet Explorer it works if you reload the page implementing it but not if you're posting to the page from a form in another page. Fireforx however seems to handle it correctly.

Thank you anyway!

Best regards
Jens Dahlin
 
Top