Learning Web Flow With Spring
From a very high level, a Web flow is just like a wizard in a stand-alone application. It guides a user through several steps of interactions. Complicated wizards may branch out depending on the information entered in early steps, so do the Web flows.
Lost VMs or Containers? Too Many Consoles? Too Slow GUI? Time to learn how to "Google" and manage your VMware and clouds in a fast and secure HTML5 App.
Well, Web environment has its uniqueness and challenges. Spring Web Flow is designed to ease it. Like any other framework, you have to overcome the learning curve before you can really take advantage of it.
The good news is the Web Flow still fits in the MVC framework overall, just with a new set of handler mapping, handler adapter, plus the new flow executor.
When a user clicks out a new flow like submitting a reward application, the Web container first looks the URL pattern and forwards it to the DispatcherServlet of the corresponding Web app. The DispatcherServlet queries FlowHandlerMapping, which looks up FlowRegistry, for a FlowHandler, then lets the FlowHandler to handle it. The handler starts a new FlowExecutor which follows through the whole flow.
While in a web flow, the URL carries the information of the step it’s in like this:
The string after the execution has a pattern like e*s*, where the first * is the execution instance number, and the second is the step number which does not necessarily correspond to a particular page. It’s more for the executor as a key than for human being.
With the Spring Web Flow framework in place, all you need is to author the flow with flow definition file, flow views, etc. The flow definition involves the view states, transitions between states, additional behaviors. For advanced web flows, you can even define flow inheritance. Sound like OO? Close, but not the same. The inheritance is just for composing purpose.
For more on the Spring Web Flow, here is a good link to its project home.