Amazon Prime: Subscription for Shipping Are you technosexual?
Feb 21

Struts Flow: Continations come to Struts

Java, Tech, Web Frameworks Add comments

Wow, Struts is a huge project:

Today, Struts is comprised of nine subprojects: Core, Taglib, Tiles, El, Faces, Scripting, Applications, Shale, and (now) Flow.

The Struts team just announced Struts Flow which brings a continuations based approach to web flows.

This is interesting stuff, and we have seen continuations popup in other communities such as Ruby, Perl, and Smalltalk.

Seaside was the first web framework that I saw with continuations, and it intrigued me from the beginning. It really does make sense to have the users ’session’ to be the core. In fact, on our projects, we put a lot of functionality there (even if it just ties into the business layers etc).

It will be interesting to see how Struts Flow gets adopted.

Take a look at an example of putting the logic in one workflow, even though web pages are being sent around to get input from the user:

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} );
}

View the Announcement

The Apache Struts team is pleased to announce the adoption of its latest subproject, Struts Flow, a continuations-based approach to complex web workflows. Struts Flow originated at the struts.sf.net project and has been formally adopted now as a Struts subproject. Struts Flow is a port of Apache Cocoon's Control Flow to Struts to allow complex workflow, like multi-form wizards, to be easily implemented using continuations-capable Javascript and eventually Java.

Today, Struts is comprised of nine subprojects: Core, Taglib, Tiles, El, Faces, Scripting, Applications, Shale, and (now) Flow. Struts Flow is different from Struts Scripting/BSF as where Scripting brings any BSF-supported scripting language to Struts Actions, Struts Flow works on redefining the traditional Model 2 state-driven workflow into simplified scripts whose execution spans multiple requests. Currently, the Rhino engine, a Javascript implementation, is used to provide continuations support, but with the maturation of Jakarta Commons Javaflow - http://jakarta.apache.org/commons/sandbox/javaflow - a Java-based continuations implementation, Java will soon be supported as well.

For more information, visit the Struts Flow website at:
- http://struts.apache.org/flow

6 Responses to “Struts Flow: Continations come to Struts”

  1. Don Brown Says:

    I should point out all but four of the current Struts subprojects are not new, but refactored out of Struts core. As subprojects, they can more easily have a life of their own to succeed or die on their own merits.

  2. Don Brown Says:

    I should point out all but four of the current Struts subprojects are not new, but refactored out of Struts core. As subprojects, they can more easily have a life of their own to succeed or die on their own merits.

  3. peter royal Says:

    struts flow is based on technologies that apache cocoon brought to the table first :) (continuations in the rhino engine)

    http://cocoon.apache.org

  4. peter royal Says:

    struts flow is based on technologies that apache cocoon brought to the table first :) (continuations in the rhino engine)

    http://cocoon.apache.org

  5. Tony Collen Says:

    Hey, that Javascript looks familiar! :)

    There’s a lot more about Javascript control flow available on the Cocoon site:

    http://cocoon.apache.org/2.1/userdocs/flow/index.html

  6. Tony Collen Says:

    Hey, that Javascript looks familiar! :)

    There’s a lot more about Javascript control flow available on the Cocoon site:

    http://cocoon.apache.org/2.1/userdocs/flow/index.html

Leave a Reply

Spam is a pain, I am sorry to have to do this to you, but can you answer the question below?

Q: What is the number before 3? (just put in the digit)