7

I am trying to implement a reasonably complex page flow (100+ pages) as a traditional web application. I found a few options, but none of them are 100% convincing

  1. Harcode the flow into the controllers, do redirects, etc. This is obviously not the best thing for maintenance
  2. JSF not only handles the flow, but also requires to use JSF as the view technology. I don't like this lock-in
  3. Spring web flow. The current version 2.3.1 defines flows in XML that is not easy to maintain. The upcoming 3.0 release promises to define flows with annotations in pure java, but it does not even have a timeline. Additionally the project development slowed down significantly in the past years.
  4. GWT and Vaadin's concept is closer to a traditional desktop application then to a web application, that is really convenient to use, but it wont fit to my project.

Additionally I found dozens of abandoned projects like this: http://javasteps.sourceforge.net/

I am wondering why all these projects are abandoned, what is the way to implement a complex page flow in 2012?

Peter Szanto
  • 7,568
  • 2
  • 51
  • 53
  • How about using BPM for defining the flow? Based on that you can use different model-2-text tools to generate spring web mvc controllers for example. – SpaceTrucker Nov 15 '12 at 14:33
  • @SpaceTrucker BPM can do a lot of things, but quite complex and not really for page flow. In my mind Spring Web Flow is like a mini BPM but only for page flow, so I would rather use that if I have to... – Peter Szanto Nov 15 '12 at 15:59
  • 1
    I actually like the XML file approach of current Spring WebFlow. I can see the whole flow in one place. That's what's bugged me about annotation-based approaches all along; you have to go digging in every file to see the whole structure. That said, maybe I'm just ignorant and time will persuade me :-) I have liked annotated "services", but they don't tend to need to be located within a large server-side flow. – dbreaux Nov 16 '12 at 22:48
  • @dbreaux I agree, at first an XML seems nice because it is a single a standard source of all flows. My problem is that XML is not meant for programming, it has no or limited validation, especially in case of Spring web flow where I mix actual java code with XML. On the other hand Spring Source Tools has a nice visualisation tool, that could visualize even the annotated flows the same way as it does with the XML. Anyways this is just dream because I havent found an annotation based flow engine, yet... – Peter Szanto Nov 19 '12 at 09:09
  • I'm working on a new Web Flow app right now, and I really like that I can do basic field setting from within the XML without having to have any Java code at all behind it. Although I agree that "coding" in XML has some downsides too. Also agree I like the STS visualization tool. But also – dbreaux Jan 05 '13 at 04:57

3 Answers3

2

Personally, I'd recommend Single Page Architecture:

Architecture of a single-page JavaScript web application?

I'm not sure if that is feasible or not with your application. I've used all the flows you mentioned above and am currently working on a single-page application and I love it. We're using Dojo on the client-side, which calls a REST API on the server. It's been pretty nice.

Vaadin is pretty solid too and is much easier to set up than just bare-bones GWT. If you have a lot of UI guys on your project that like to code in CSS and Javascript, they'll hate that approach though.

Spring Webflow is pretty solid actually. I haven't looked at it in a while, but when I was using it, it got the job done for what I worked on at the time.

Community
  • 1
  • 1
sma
  • 9,449
  • 8
  • 51
  • 80
  • 1
    Btw, I know you mentioned it was a Java application, but I guess I'm just assuming you could write the server-side Java as a REST API and then code the front-end using Javascript. Again, may not be feasible for you. – sma Nov 15 '12 at 14:39
  • the answer you referenced suggests to use PureMVC, I just quickly looked at it, but seems like it is quite similar to what Vaadin and GWT does, so not sure what would be the advantage. I quite like both Vaading and GWT, but I feel it is not really an exact fit to my project as I need more fine grained control over the generated HTML. You mentioned you are currently working on a single page application, do you use Pure MVC or something else? – Peter Szanto Nov 15 '12 at 15:58
  • We are using Dojo widgets and templates for our application. We also use a bit of templating using Dojo's lang.replace feature, which basically treats HTML sort of like Mustache.js. If you need more fine-grained control over HTML, then a JS framework may be a good fit for you. JSF generates garbage and Vaadin and GWT generate the HTML also. With a framework like Dojo, Backbone, or PureMVC, you could write the HTML yourself. – sma Nov 15 '12 at 20:01
  • I am just still missing the piece of how it helps me reducing the horrible mess of endless if else statements that handles the pageflow on server side. – Peter Szanto Nov 16 '12 at 08:00
  • Sorry, I completely forgot to respond to this. Have you looked at Backbone? The Router implementation in Backbone may help you also. – sma Dec 30 '12 at 00:46
2

This is really late but I don't see a satisfactory answer to this question and would like to share an approach I had tried in a recent project which I feel is better than the spring web flow approach which is strictly tied down to spring views. I created a SPA using angular js with Spring MVC. In angular js I did not use routers or state, rather I created a div within the controller like below

<div width="100%" id="fullertonDataPanel" ng-include="page"></div>

On the server side to capture all possible transitions from one frame(I am referring to a particular screen in the SPA) to another I created a tree of rules using MVEL . So in the database I had a structure which stored a tree of rules for every frame . The data in the MVEL expressions were being set by the various services each action invoked. Thus on any action the following steps were followed.

1) Validate the action.

2) Invoke various services.

3) Capture the data from these services and merge it with the existing data of the user.

4) Feed this captured data into collection of rules for each frame along with the details of the current frame.

5) Run the rules of the tree w.r.t to current frame and fetch its output.

6) If there is only one transition then that is the final transition. If there are 2 transitions and one is default then ignore the default transition and use the other transition.

7) Return the template name of the transition to the angular controller and set the value of the page variable in the scope of the controller.

Using this approach all my services had to do was store data in different data fields w.r.t a particular action. All the complex if-else conditions for Web Flows or any complex process definitions(like the one defined in Spring-Web Flow) were not required. The MVEL rule engine managed all that and since it was all in the database it could be changed without needing a server re-start.

I believe this generic approach with MVEL is a flexible approach which comprehensively handles the problem of a convoluted flow without making the application code a mess or adding additional unnecessary xml files.

prashant
  • 1,382
  • 1
  • 13
  • 19
1

There is a new MVC framework and web flow implementation for Vaadin component model called Lexaden Web Flow

You can try it out for your application as possible alternative.