While the initial target of the extracted Control Flow is Struts, the Flow code is reusable from other non-Struts environments. This means Control Flow could be used to drive non-Struts JSP applications, portlets, or even complex web services.
For more information, see the project's temporary website: http://struts.sf.net/struts-flow
To show the code in action, here is the implementation of a number guessing game:
function main() {var random = Math.round( Math.random() * 9 ) + 1; var hint = "No hint for you!" var guesses = 0;
while (true) {// send guess page to user and wait for response
forwardAndWait("failure", { "random" : random, "hint" : hint,
"guesses" : guesses} );
// process user's guess
var guess = parseInt( getRequestParams().guess );
guesses++;
if (guess) {
if (guess > random) {
hint = "Nope, lower!"
} else if (guess < random) {
hint = "Nope, higher!"
} else {
// correct guess
break;
}
}
}
// send success page to user
forwardAndWait("success", {"random" : random, "guess" : guess, "guesses" : guesses} );
}
Don
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

