Home > Software Development > Learning Web Flow With Spring

Learning Web Flow With Spring

February 18th, 2010 Leave a comment Go to comments

Web flow is the most confusing part so far in RIA with Spring training, therefore a whole day was dedicated to this.

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.

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:

http://localhost:8080/webflowactions2 /admin/rewards/newReward?execution=e2s5

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.

  1. No comments yet.
  1. No trackbacks yet.