Can Spring Webflow eliminate the need for controller classes?
Asked Answered
S

2

6

For a relatively simple application, can Webflow be employed to reduce the need to create form controllers? Well, certainly it can, but I guess what I'm asking is: can and should I write an entire application using Webflow for all of the controller / view logic if my goal for doing so is to reduce the amount of code that I write?

I'm struggling my way through the (poor) Webflow documentation and am wondering if it's worth it, or if I should just stick to regular MVC.

Shiva answered 3/6, 2009 at 18:4 Comment(0)
H
6

The use case for Web Flow is to solve the problem involved with controller logic that spans multiple-page navigation (a pageflow, or wizard). If you don't have to have a form split across multiple pages (or need several small forms to participate in a single transaction), you probably don't need a Pageflow.

Most applications do need this, however. Anything more than simple CRUD stands to benefit.

Pageflows provide a natural cache for the data and can solve problems involved otherwise when using back button navigation and multiple frames/tabs.

If you are thinking about how to store data that needs to live longer than a single request (the common but misguided view is to store in the HttpSession) then you will definitely get something out of Web Flow. If you're not doing anything like that and processing everything at the request-scope then odds are you don't need Web Flow.

Update: Web Flow can eliminate the need for specialized controller classes to accomplish following a path of page transitions/form updates along a predefined workflow. If you don't need to do this, you can save yourself a lot of configuration/complexity just by using MVC.

Houseboat answered 3/6, 2009 at 18:19 Comment(2)
Ok, but should everything be part of a flow? Let's say I have a screen that just displays some records. The user can click on a record and is taken to a screen where he can update it....perhaps each record in the view simply has a link to the update view and passes the record id. I could write a controller to setup that initial view, or I could have a "flow" with one state. I'm not understanding something here...Shiva
In my understanding, you should go all or nothing with Web Flow. In the scenario you describe, you don't need any specialized controllers. But to answer your question as it was originally phrased, yes, that is a goal of Web Flow - to eliminate the need for controllers to become specialized to handle workflow type interactions.Houseboat
A
3

SpringMVC and Spring WebFlow can be used together where appropriate - there is nothing odd about that.

If you have a use-case which is simple crud and you think you could easily implement this using SpringMVC then that's probably the right choice.

Note: You could also achieve this in WebFlow too and that neither better or worst.

If you have complicated wizard logic and state management requirements then WebFlow is great plus you get many other features for free like transactions and persistence support (Version-2).

Auria answered 22/6, 2009 at 12:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.