Spring Web Flow (SWF) is an emerging module of The Spring Framework that aims to be the best solution for the management of web application page flow, useable in any web framework. In this latest TSS article, the founders of Spring Webflow illustrate how a complex process can be implemented using the framework.
Read Spring Webflow
-
Article: Using Spring Webflow (36 messages)
- Posted by: Floyd Marinescu
- Posted on: May 06 2005 14:06 EDT
Threaded Messages (36)
- I would like to see the same example using Java instead of XML. by Jose Luiz on May 09 2005 17:18 EDT
- It is possible (using Java) by Edmon Begoli on May 09 2005 18:08 EDT
- Keith Donald by Keith Donald on May 09 2005 23:34 EDT
- A possible OS workflow alternative by George Mournos on May 11 2005 06:01 EDT
- Integration statement by Damien Evans on May 09 2005 22:46 EDT
- Integration statement by Keith Donald on May 09 2005 23:42 EDT
- Article: Using Spring Webflow by Isto Nikula on May 10 2005 05:09 EDT
- Article: Using Spring Webflow by Keith Donald on May 10 2005 09:22 EDT
-
Article: Using Spring Webflow by Keith Donald on May 10 2005 09:31 EDT
- Article: Using Spring Webflow by Donald Diego on May 10 2005 01:52 EDT
- Article: Using Spring Webflow by Isto Nikula on May 10 2005 10:04 EDT
- Re: Article: Using Spring Webflow by Anand Vidyasagar on April 03 2008 07:07 EDT
-
Article: Using Spring Webflow by Keith Donald on May 10 2005 09:31 EDT
- Article: Using Spring Webflow by Todd Murray on May 10 2005 09:25 EDT
- Article: Using Spring Webflow by Keith Donald on May 10 2005 09:49 EDT
-
Article: Using Spring Webflow by Nils Kilden-Pedersen on May 10 2005 10:18 EDT
- Article: Using Spring Webflow by Greger Sernemar on May 11 2005 02:49 EDT
- Article: Using Spring Webflow by Keith Donald on May 10 2005 09:22 EDT
- Support for XWork/WebWork? by Shane Witbeck on May 10 2005 10:29 EDT
- Support for XWork/WebWork? by Shane Witbeck on May 10 2005 10:34 EDT
- Thank you by artful dodger on May 10 2005 11:59 EDT
- Article: Using Spring Webflow by Igor Kolomiets on May 10 2005 12:29 EDT
- Spring Web Flow and Books by Matt Raible on May 10 2005 15:53 EDT
- Article: Using Spring Webflow by kundan varma on May 11 2005 02:33 EDT
- Article: Using Spring Webflow by Keith Donald on May 11 2005 10:33 EDT
- Error handling by Sergey Smirnov on May 11 2005 04:22 EDT
- Article: Using Spring Webflow by Keith Donald on May 11 2005 10:33 EDT
- Article: Using Spring Webflow - UML? by Gary Watson on May 11 2005 19:08 EDT
- Modelling menus with statecharts by Vadim Gurov on May 12 2005 06:08 EDT
- OTT support? by Karl Banke on May 12 2005 07:37 EDT
- YADSM by Peter Pilgrim on May 13 2005 05:47 EDT
-
YADSM by Keith Donald on May 16 2005 06:48 EDT
-
YADSM by Karl Banke on May 17 2005 03:31 EDT
- YADSM by Keith Donald on May 18 2005 02:37 EDT
-
YADSM by Karl Banke on May 17 2005 03:31 EDT
-
YADSM by Keith Donald on May 16 2005 06:48 EDT
- OTT support? by Erwin Vervaet on May 14 2005 02:56 EDT
- OTT support? by Karl Banke on May 16 2005 01:59 EDT
- YADSM by Peter Pilgrim on May 13 2005 05:47 EDT
- Security and Persistence by Paul Bedworth on May 17 2005 11:10 EDT
- Security and Persistence by Keith Donald on May 17 2005 13:41 EDT
- Spring Web Flow by srinivas chennamaraja on May 17 2005 01:58 EDT
- Security and Persistence by Keith Donald on May 17 2005 13:41 EDT
-
I would like to see the same example using Java instead of XML.[ Go to top ]
- Posted by: Jose Luiz
- Posted on: May 09 2005 17:18 EDT
- in response to Floyd Marinescu
I would like to see the same example using Java instead of XML. Is it possible? -
It is possible (using Java)[ Go to top ]
- Posted by: Edmon Begoli
- Posted on: May 09 2005 18:08 EDT
- in response to Jose Luiz
Check out the Spring WebFlow practical guide at:
http://opensource.atlassian.com/confluence/spring/display/WEBFLOW/Practical+Guide
It shows both Java and XML examples.
Thank you,
Edmon
http://blogs.ittoolbox.com/eai/software/ -
Keith Donald[ Go to top ]
- Posted by: Keith Donald
- Posted on: May 09 2005 23:34 EDT
- in response to Jose Luiz
Yes, it is very much possible! XmlFlowBuilder is just that--another FlowBuilder implementation. It's possible to create your own custom FlowBuilders,in Java, a scripting language, a database, or sourced from a another form (perhaps a OSWorkflow definition, as a possibility!).
Here's a quick snippet of the Bookflight flow in Java instead of API:
public class BookFlightFlowBuilder extends AbstractFlowBuilder {
public void buildStates() {
addActionState("obtainTripInfo",
action("bookingActions"),
new Transition[] {
on(success(), "suggestItineraries"),
on(error(), "tryAgain")
}
);
...
}
}
Checkout the Phonebook sample application for a complete Java-based flow builder implementation for comparsion along side a corresponding Xml version. In general, the sample applications are a great way to hit the ground quickly and to see the different features of the framework in action. -
A possible OS workflow alternative[ Go to top ]
- Posted by: George Mournos
- Posted on: May 11 2005 06:01 EDT
- in response to Keith Donald
I believe that Spring Web Flow is tackling a serious problem, and I like the idea behind it.
I believe though that instead of defining a custom XML, the authors should also look at XPDL, which is the defacto XML language of defining workflows. Page Flows are Deterministic finite automate (DFAs) and XPDL workflows have some syntactic sugar that would not apply for pageflows (e.g. which user is doing what at which state, or that after a state the control can go to two states). But again XPDL workflows are DFAs, they are not of Turing machine complexity. Additionally, XPDL comes with LGPL tools for
parsing and editing.
The problem with web flows came up to "theserverside" forum also a few weeks ago, with the article:
http://www.theserverside.com/articles/article.tss?l=VelocityEngine
Where somebody defined pageflows declaratively using some features of Velocity.
In my reply to this article I've described an XPDL based solution to this problem that could also apply here:
http://www.theserverside.com/news/thread.tss?thread_id=32467#162532
To close here I believe that the Spring Web Flow project should also be driven by XPDL definitions. This should be
a very easy thing to do, the graphical editors and parsers
for XPDL are already there, and this would be a very cheap
solution for providing the Spring Web Flow with a UI editor.
A UI editor is very useful if somebody is dealing with flows
that span hundreds of pages.
George Mournos -
Integration statement[ Go to top ]
- Posted by: Damien Evans
- Posted on: May 09 2005 22:46 EDT
- in response to Floyd Marinescu
As a standalone library, Spring Web Flow is a strong fit for integration with other frameworks. Out of the box Spring MVC, Struts, and Portlet MVC integration is already provided. JSF and Tapestry integration are expected by the final release.
What about WebWork? -
Integration statement[ Go to top ]
- Posted by: Keith Donald
- Posted on: May 09 2005 23:42 EDT
- in response to Damien Evans
From reviewing the WebWork Roadmap, it looks like they're considering Spring Web Flow integration for future releases. Such integration should be quite similiar in approach to how it's done for Spring MVC: a special flow action that acts as a bridge between web work and a HTTP-based flow execution manager.
Keith -
Article: Using Spring Webflow[ Go to top ]
- Posted by: Isto Nikula
- Posted on: May 10 2005 05:09 EDT
- in response to Floyd Marinescu
SWF looks very nice!
Two questions related to the article:
1. The "finish" transition of the sub-flow-state "chooseSeatAssignments" points directly to the view attribute (reservationConfirmation) of the end-state "displayConfirmation" (instead of pointing to the state id). Is this a typo or should it really be like this? If it´s ok to do it like this, then what is the difference between pointing transitions to state ids and directly to view attributes?
2. I like the way how the flow is modeled using UML state diagram. However, the desicion-state used in the example is not depicted in the diagram. Any ideas how to do this in a consistent manner or is it purposedly left out?
/Isto Nikula -
Article: Using Spring Webflow[ Go to top ]
- Posted by: Keith Donald
- Posted on: May 10 2005 09:22 EDT
- in response to Isto Nikula
1. That's a typo -- we went through several iterations with state naming for clarity/consistency -- looks like we didn't get one changed :-) -- the 'finish' transition of 'chooseSeatAssignments' should indeed take the flow back to the 'displayReservationVerification' state.
2. It was just left out -- it really should be in the diagram. It'd be another state with the events (the transition criteria) being the expressions instead of a static event ID like 'success'.
Great observations! I'll let Floyd know so these can be fixed.
Keith -
Article: Using Spring Webflow[ Go to top ]
- Posted by: Keith Donald
- Posted on: May 10 2005 09:31 EDT
- in response to Keith Donald
One additional note:
The 'decision-state' could have certainly been modeled as a action-state with a Action that makes the decision. This would've arguably translated better from the UML State Diagram, as you could better highlight how _results_ of expression evaluation are processed, rather than the expressions themselves.
For instance, something like:
<action-state id="isPassengerInfoRequired">
<action bean="bookingActions"/>
<transition on="yes" to="enterPassengerInformation"/>
<transition on="no" to="displayReservationVerification"/>
</action-state>
That's pretty elegant I think--the action answers the question, the flow responds to the answer to decide where to go next. The manner in which it calculates the answer is fully encapsulated. -
Article: Using Spring Webflow[ Go to top ]
- Posted by: Donald Diego
- Posted on: May 10 2005 13:52 EDT
- in response to Keith Donald
Looks good. This is very similar to how JBoss jBPM models "workflows" (which are very similar to pageflows, except they are for application code, not screens, I'm sure the two could be merged though) - a state based transition with events. That shows that Spring Webflow aligns well with flow theory, which jBPM is closely connected to.
I'm not sure this is much of a change from Struts-type flows though, except for the concept of splitting them into modules that can be reused (neat idea). There are already tools that can visualize the Struts flows in this way, it's just that the source file is harder to read than the format that is used in Webflow. -
Article: Using Spring Webflow[ Go to top ]
- Posted by: Isto Nikula
- Posted on: May 10 2005 10:04 EDT
- in response to Keith Donald
Well, it seems that it´s easy to mix up with the naming :) I just noticed that my original mail also had the names confused: should be reservationVerification (was reservationConfirmation) and displayReservationVerification (was displayConfirmation). Anyway, your reply has the naming right, thanks.
/Isto -
Re: Article: Using Spring Webflow[ Go to top ]
- Posted by: Anand Vidyasagar
- Posted on: April 03 2008 07:07 EDT
- in response to Keith Donald
Could you elaborate a little bit more on the decision-state. In the given example I can see two . How does this work in general? If the first test evaluates to true then It enters into a state of executing the sub-flow. Could you throw more light on when exactly does the second get executed. From a logical perspective I can see that it enters into the subflow and transitioned to "displayReservationVerification". I am not sure that the second is even evaluated. Would really appreciate if you can write a paragraph around the decision-state with this example. Appreciate your time!! Anand -
Article: Using Spring Webflow[ Go to top ]
- Posted by: Todd Murray
- Posted on: May 10 2005 09:25 EDT
- in response to Isto Nikula
What would be really useful is to be able to build the basic functionality from the UML diagram. -
Article: Using Spring Webflow[ Go to top ]
- Posted by: Keith Donald
- Posted on: May 10 2005 09:49 EDT
- in response to Todd Murray
Yes, that would indeed be a great feature. We've done all the heavy lifting to support such a feature at this point: there is a very rich definition API that a StateDiagramFlowBuilder could use to produce a fully configured Flow definition. Similiarily, there is enough information in the engineered Flow definition to then generate the Action skeletons.
Currently two tools -- Spring IDE and Gaijin Studio (both Eclipse plugins) -- are building graphical editors atop SWF. It'd be great to see support for UML state diagrams emerge as part of the tools offering as well.
Keith -
Article: Using Spring Webflow[ Go to top ]
- Posted by: Nils Kilden-Pedersen
- Posted on: May 10 2005 10:18 EDT
- in response to Todd Murray
What would be really useful is to be able to build the basic functionality from the UML diagram.
Take a look at UniMod. -
Article: Using Spring Webflow[ Go to top ]
- Posted by: Greger Sernemar
- Posted on: May 11 2005 02:49 EDT
- in response to Nils Kilden-Pedersen
In another framework we used rose script to generate state java classes from rose state diagrams, it was very handy.
/Greger Sernemar -
Support for XWork/WebWork?[ Go to top ]
- Posted by: Shane Witbeck
- Posted on: May 10 2005 10:29 EDT
- in response to Floyd Marinescu
I saw mention for out of the box support for Struts, etc. Has anyone succussfully (and easily?) used this with the Spring/XWork/WebWork stack? -
Support for XWork/WebWork?[ Go to top ]
- Posted by: Shane Witbeck
- Posted on: May 10 2005 10:34 EDT
- in response to Shane Witbeck
I saw mention for out of the box support for Struts, etc. Has anyone succussfully (and easily?) used this with the Spring/XWork/WebWork stack?
To clarify I did see Keith's statement about the WebWork roadmap. I'm curious if anyone has integrated with the current stack. -
Thank you[ Go to top ]
- Posted by: artful dodger
- Posted on: May 10 2005 11:59 EDT
- in response to Floyd Marinescu
Spring, Hibernate, Appfuse...Thank you!!! -
Article: Using Spring Webflow[ Go to top ]
- Posted by: Igor Kolomiets
- Posted on: May 10 2005 12:29 EDT
- in response to Floyd Marinescu
Will SWF be covered in the upcoming "Professional Java Development with the Spring" book? -
Spring Web Flow and Books[ Go to top ]
- Posted by: Matt Raible
- Posted on: May 10 2005 15:53 EDT
- in response to Igor Kolomiets
Will SWF be covered in the upcoming "Professional Java Development with the Spring" book?
I hope so. I'm providing some coverage in Spring Live. The "Advanced Form Processing" chapter (#13) has a 9-page section on Spring Web Flow that's likely to grow in the future. This chapter should be released sometime in June. -
Article: Using Spring Webflow[ Go to top ]
- Posted by: kundan varma
- Posted on: May 11 2005 02:33 EDT
- in response to Floyd Marinescu
So SWF is a compliment to existing frameworks. What is some one has its own framework and wanna use SWF?? Again how to use the flows or better extend the flows for EJB's. Where can i get the docs related to SWF about the patterns and approach it uses.
Thanks
kundan -
Article: Using Spring Webflow[ Go to top ]
- Posted by: Keith Donald
- Posted on: May 11 2005 10:33 EDT
- in response to kundan varma
Checkout our the Web Flow space here:
http://opensource.atlassian.com/confluence/spring/display/WEBFLOW/Home
I'd recommend studying the web.flow.execution package documentation as well -- particularly the FlowExecutionManager class -- and using web.flow.mvc (Spring MVC integration) and web.flow.struts (Struts integration) as a guiding base to integrating Web Flow with your homegrown framework.
Keith -
Error handling[ Go to top ]
- Posted by: Sergey Smirnov
- Posted on: May 11 2005 16:22 EDT
- in response to Keith Donald
is the error handling going to be added? -
Article: Using Spring Webflow - UML?[ Go to top ]
- Posted by: Gary Watson
- Posted on: May 11 2005 19:08 EDT
- in response to Floyd Marinescu
SWF seems to fall in with current thinking; namely, that
you can't ever get away from states and state machines. State
machines and automaton are excellent ways to model flows
and I think SWF illustrates it very well.
I like the idea of sub-flows and have worked on a similar
framework myself which defines subflows as simple invocations
of existing flows (or sub-states). The framework is older than
SWF so I'm making the comparison in order to switch to SWF.
One question I have though: if rendered and
printed out, would such flows be useful to managers or
users when presented in UML? In my experience, unless managers are somewhat technical, UML is difficult for them
to comprehend; never mind the users, designers or customers
that may be presented with the model too.
Regards,
Gary
__________________________________________________ -
Modelling menus with statecharts[ Go to top ]
- Posted by: Vadim Gurov
- Posted on: May 12 2005 06:08 EDT
- in response to Floyd Marinescu
Here are some examples where Spring Web Flow would not be appropriate:
* Index pages
* Welcome pages
* Menus
* Simple form flows (one page)
Actually, menus may be modelled using UML statecharts also with a help of superstates. All simple states should be put into one super state. transitions from superstate to included simple states - are menu links. -
OTT support?[ Go to top ]
- Posted by: Karl Banke
- Posted on: May 12 2005 07:37 EDT
- in response to Floyd Marinescu
Ah, yet another (distributed) state machine. I haven't looked into it too much, but at first glance there seems to be no ootb support for one time transaction patterns. Given that it is 2005 and I haven't overlooked it, I would find that rather frightening. -
YADSM[ Go to top ]
- Posted by: Peter Pilgrim
- Posted on: May 13 2005 05:47 EDT
- in response to Karl Banke
Ah, yet another (distributed) state machine. I haven't looked into it too much, but at first glance there seems to be no ootb support for one time transaction patterns. Given that it is 2005 and I haven't overlooked it, I would find that rather frightening.
I read the article. Although I have encountered state machines the theory since University and helped to build an implementation many years ago. I was not very impressed with this state of the art. It was not helped by the style of the English prose used. I get ever so tired of reading about how things could much be made omnipotently clear all the time, and multiple use of cliche techno-business words and phrases.
It is kind of now so obvious when the article purports claims that if you use this particular toolkit and then invest your hard-earn working time on that other framework, then smart developers are automatically more productive and more efficient. I think here is another XML that novice developer or administrator has to support. That means another SL2 support document to write.
Programming in Java is no longer that anymore. It is programming in Java with umpteen XML files to considered. Instead it will be XML and beyond.
There are too many articles out there where you have to take a huge of faith. I did not get to complete reading to the end of the article. In fact, I had to put the print down. This is crass commercialism gone very bad.
State machines have been around for a long time. I cannot see web flow being different to other Java implementations. The last one I spent time was the venerable SMC (State Machine Compiler) http://smc.sf.net/ . I am not plugging it [SMC], but just giving an example of such Finite State Machine, to give such beasties their full computer science degree title.
I guess this will run on and on. Oh yes, I do agree with Karl Banke's critique and audit about transactions. -
YADSM[ Go to top ]
- Posted by: Keith Donald
- Posted on: May 16 2005 18:48 EDT
- in response to Peter Pilgrim
Our focus in this article was to:
1. Clearly communicate what SWF is, what problem it addresses, and how it is positioned other web frameworks.
2. Demonstrate how to use it via example by walking-through a realistic business case.
3. Provide a brief introduction of some of the advanced features (flow listeners, continuations etc.)
We simply can't cover everything in one article. Would I have liked to get down into the details of the state machine implementation? Certainly! Any avid Computer Scientist would love to read that (and Pete I don't think you'd be dissapointed.). But that'd take another 10 pages. We felt our time was better spent here demonstrating key user features offered by the framework.
Karl, what Erwin refers to is our out-of-the-box support for one-time applications transactions (duplicate submit detection, etc.). It's supported by our TransactionSynchronizer interface, with the default implementation a token-based strategy. Take a look at this interface definition--would you suggest a better name than "Synchronizer?"
Pete, re: your concern about XML files. Nothing says you have to define your flows in XML--there is full support for Java-based flow builders, and we have sample applications that demonstrate them. There is no XML hell here.
In regards to the back-button challenges resultant from a stateful system, yes they definitely exist. We've documented on our WIKI the issues there and the options the framework provides for addressing them out-of-the box: http://opensource.atlassian.com/confluence/spring/display/WEBFLOW/Frequently+Asked+Questions. Our support here will continue to improve.
Thanks,
Keith -
YADSM[ Go to top ]
- Posted by: Karl Banke
- Posted on: May 17 2005 03:31 EDT
- in response to Keith Donald
Karl, what Erwin refers to is our out-of-the-box support for one-time applications transactions (duplicate submit detection, etc.). It's supported by our TransactionSynchronizer interface, with the default implementation a token-based strategy. Take a look at this interface definition--would you suggest a better name than "Synchronizer?"
No, Synchronizer is just fine, because that is what it does. The inherent problem is that you try to support a state machine and then you don't, because the state machine is essentially distributed. And if you support a certain amount of "free navigation", the concept of "continuations" does not work anymore either: Pressing the back button, say after booking a flight and resubmitting a page may never ever use a continuation or you will end up with two tickets (Which is in opinion why continuation are a bad concept anyway as soon as your flow is "doing business", while they are nice for navigating complex "logically" linked content, semantical trees, decision making systems etc.).
What so puzzles me as that things like that are around for a long long time, see for example BEA Webflow engine (BTW, didn't they object to your name, can't believe Webflow is not a BEA trademark).
These approaches ran into exactly the same problems and they more often than not left it to developers to solve them all over again. So in 2005, I would assume that issues like that would already be "disigned in". After all, by now, the problem should be well understood. -
YADSM[ Go to top ]
- Posted by: Keith Donald
- Posted on: May 18 2005 14:37 EDT
- in response to Karl Banke
Karl,
We're hopeful we'll be able to offer a ootb TransactionSynchronizer implementation that will work with continuations (yes, obviously the flow-scoped TokenBased strategy does not), to support restoring a transactional business flow at any point in history with determination if the backing transaction has ended and thus the flow should not be restored.
We're trying very hard to design this stuff in from the get-go -- take a look at the design of the system and let us know what you think. There is some good stuff there.
Keith -
OTT support?[ Go to top ]
- Posted by: Erwin Vervaet
- Posted on: May 14 2005 02:56 EDT
- in response to Karl Banke
Actually, there is support for one-time application transactions using the TransactionSynchronizer.
Erwin -
OTT support?[ Go to top ]
- Posted by: Karl Banke
- Posted on: May 16 2005 13:59 EDT
- in response to Erwin Vervaet
Actually, there is support for one-time application transactions using the TransactionSynchronizer.Erwin
Erwin, unfortunately there is not. One time transaction is not (only) about that there is only one transaction running at the same time. It is about that one transaction can only be run once, once it has been started.
Essentially it is about protected you from hitting submit more than once, hitting back a couple of times and then hitting resubmit. It is one of most crucial and most often reinvented patterns in web application programming. Your solution may help here, if and only if, you are actually enforcing the state machine on the server side.
If you do that, however you would be in a lot of trouble for some stuff that you absolutely must be able to do in a web application environment (such as enabling usage of the back button whereever it seems feasible).
On a slightly different note, any web application state machine must have an option of enabling client side redirects where needed (back button protection, enable reload button without resubmit etc.). I assume you do offer something like that :-) -
Security and Persistence[ Go to top ]
- Posted by: Paul Bedworth
- Posted on: May 17 2005 11:10 EDT
- in response to Floyd Marinescu
Does anyone know if this framework is able prevent you from submitting or viewing pages that do not belong to the current state?
And, is the flow execution id secure, since the article says that it is tracked as a hidden field by the client?
Also can the state of the state machines be persisted and restored to support pausing and resuming? -
Security and Persistence[ Go to top ]
- Posted by: Keith Donald
- Posted on: May 17 2005 13:41 EDT
- in response to Paul Bedworth
Does anyone know if this framework is able prevent you from submitting or viewing pages that do not belong to the current state?
Yes, a state machine by nature is very controlled. Once in a state, you can only leave by way of a valid transition. Templates rendered when view states are entered easily secured by placing them within /WEB-INF.And, is the flow execution id secure, since the article says that it is tracked as a hidden field by the client?
The flow execution id is a randomly-generated MD5 encoded string by default.Also can the state of the state machines be persisted and restored to support pausing and resuming?
Yes, using the pluggable FlowExecutionStorage interface. Three such persistence and restoration strategies are provided out of the box: session-based, session-continuation-based, and client. -
Spring Web Flow[ Go to top ]
- Posted by: srinivas chennamaraja
- Posted on: May 17 2005 13:58 EDT
- in response to Keith Donald
How different is SWF from Apache Behive (in the incubator) NetUI Page Flows?
Srini