> From: Leon Amdour <[EMAIL PROTECTED]>
>
> Just to make it clearer, let's say I have a web page containing a
> question. A user has limited time to answer.
> If time's up before answer is received I want to go to another page.

This may be of interest to more than just Leon, so I am cc'ing the list.

So the tactic (and please read the notes at the bottom) here would be to place  
a refresh tag at the top of the html template and before the <body> tag. It  
will look something like this (the content tag determines the time -in this  
case 60 seconds- and the URL to be retrieved):

<meta http-equiv="REFRESH" content="60;  
URL=http://my.woApp.com/cgi-bin/WebObjects/WebTest.woa/wa/userTimedOut">

Then in DirectAction.java you will have a method called userTimedOut:

    public WOComponent userTimedOut() {
        // here you will write whatever magic you want to do to ensure that  
the next page you
        // show the user will be the right one.
        // You might want to pass some page specific information into the  
direct action
        // and to do this you would just append ?key=value to the end of the  
url in the
        // refresh section so that it might look like:
        //  
URL=http://my.woApp.com/cgi-bin/WebObjects/WebTest.woa/wa/userTimedOut?page=1
        // then you would utilize that information in determining what page to  
display next...

        return pageWithName("theNextPageYouWantTheUserToSee");
    }

Just remember to add a little fudge time to factor in browser/connection  
loading speeds --which will vary from user to user deppending on their  
circumstance. Also, if you need to keep score for this specific user, you will  
need to have a session var that links userName with the scoring system and pass  
the userName (or whathave you) back into the directAction to keep track of the  
score for missing a question, this must be done because you will be devoid of  
session as you enter the directAction (unless you are carting that around as  
part of your key=value pairs).

Cheers!

Alex

----
Alex Horovitz
Senior Systems Engineer
Apple Computer, Inc.
http://www.apple.com/webobjects

Reply via email to