Spring Webflow 可以消除对控制器类的需求吗?

发布于 2024-07-22 14:37:29 字数 188 浏览 8 评论 0原文

对于一个相对简单的应用程序,是否可以使用Webflow来减少创建表单控制器的需要? 嗯,当然可以,但我想我要问的是:如果我这样做的目标是减少我编写的代码量,我是否可以并且应该使用 Webflow 为所有控制器/视图逻辑编写整个应用程序?

我正在努力阅读(糟糕的)Webflow 文档,并且想知道这是否值得,或者我是否应该坚持常规 MVC。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

止于盛夏 2024-07-29 14:37:29

Web Flow 的用例是解决涉及跨多页面导航(页面流或向导)的控制器逻辑的问题。 如果您不必将表单拆分为多个页面(或需要多个小表单来参与单个事务),则您可能不需要页面流。

然而,大多数应用程序确实需要这个。 任何比简单的 CRUD 更重要的事情都会受益。

页面流为数据提供了自然的缓存,并且可以解决使用后退按钮导航和多个框架/选项卡时所涉及的问题。

如果您正在考虑如何存储需要比单个请求更长时间的数据(常见但误导的观点是存储在 HttpSession 中),那么您肯定会从 Web Flow 中得到一些东西。 如果您没有做类似的事情并在请求范围内处理所有内容,那么您很可能不需要 Web Flow。

更新:
Web Flow 可以消除对专用控制器类的需求来完成沿着预定义工作流程的页面转换/表单更新路径。 如果您不需要这样做,则只需使用 MVC 即可节省大量配置/复杂性。

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.

悸初 2024-07-29 14:37:29

SpringMVC 和 Spring WebFlow 可以在适当的情况下一起使用 - 这没有什么奇怪的。

如果您有一个简单的用例,并且您认为可以使用 SpringMVC 轻松实现它,那么这可能是正确的选择。

注意:您也可以在 WebFlow 中实现这一点,但这既不好也不坏。

如果您有复杂的向导逻辑和状态管理要求,那么 WebFlow 就很棒,而且您还可以免费获得许多其他功能,例如事务和持久性支持(版本 2)。

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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文