什么时候在 Spring MVC 之上使用 Spring WebFlow 才有意义?

发布于 2024-09-11 06:38:03 字数 199 浏览 5 评论 0原文

Spring MVC 已成为构建企业 Web 应用程序的非常流行的框架。任何复杂的 Web 应用程序都有某些需要编码的流程,包括一些条件流程(即,如果信用卡信息正确,则显示已处理的订单,如果输入不正确,则显示验证错误)。

什么时候在 Spring MVC 之上使用 Spring WebFlow 才有意义?关于使用 Spring WebFlow 的决策过程应该是什么?

Spring MVC has become a very popular framework for building enterprise web applications. Any complex web application has certain flows that need to be coded, including some conditional flows (i.e., show order processed if the credit card information was correct, or validation errors if something was not entered correctly).

When does it make sense to use Spring WebFlow on top of Spring MVC? What should be the decision making process regarding using Spring WebFlow?

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

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

发布评论

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

评论(4

没有心的人 2024-09-18 06:38:03

如果您有一个具有某些应用程序流程的 Web 应用程序。例如,如果您有某种注册流程,一个按钮可以转到一个页面,而另一个按钮可以转到另一个页面。 Spring Webflow 可以很好地处理到不同流程集的转换。

基本上,如果应用程序的某些部分是链接的并且页面在执行过程中相互依赖,则最好使用 SWF。

If you have a web application that has some application process. For example, if you have some kind of sign up process that one button can go to one page while another can go to a different page. Spring Webflow can handle transitioning to different sets of processes very well.

Basically, if some part of your application is linked and pages depend on each other during the course of an execution SWF is good to use.

孤檠 2024-09-18 06:38:03

我个人最喜欢 webflow 的两点:

  1. 继承流和视图状态的能力。当您想要在应用程序的不同部分之间共享一些常见的逻辑方面时,这非常方便。例如,您希望将 CRUD 逻辑抽象到单独的流中,然后允许子流继承此逻辑。每个流都可以有输入和输出,因此您的逻辑可以非常细粒度。
  2. 强大的测试框架。在单元测试中可以涵盖流程逻辑的几乎所有方面。您可以通过编程来模拟许多事情,例如操作触发、从一个视图到另一个视图的转换、流程持久性处理等等。

我不喜欢的是新版本的不一致和向后兼容性差。例如,最新的 webflow 2.1 与 JSF 1.x jira 不兼容。与 Spring Security 集成也存在许多问题。例如,在 spring security 3.x 中,他们只是更改了一些包名称
一般来说,正如 Sasi 提到的,webflow 几乎会迫使你将逻辑分离在不同的 webflow 中 - 我认为这很好。

What I personally like in webflow most are 2 things:

  1. Ability to inherit flows and view-states. This is quite handy when you have some common logic aspects that you want to share between different parts of your application. For example, you have CRUD logic that you want to abstract in separate flow and then allow child flows to inherit this logic. Each flow can have input and output, so your logic can be very fine-grained.
  2. Powerful testing framework. It is possible to cover almost all aspects of your flow logic in unit tests. You can emulate many things programmatic, such as action firings, transitions from one view to another, flow persistence handling and and so on

What I don't like is inconsistency and poor backward compatibility of newer versions. For example, latest webflow 2.1 is not compatible with JSF 1.x jira. There are also numerous problems with integrating with Spring Security. For example, in spring security 3.x they just changed some package names
In general, as Sasi mentioned, webflow will almost force you separate your logic in different webflows - and this is nice I think.

蘑菇王子 2024-09-18 06:38:03

Webflow 有效解决的一个问题是,它将业务逻辑与控制逻辑完全分离(或者至少很难混合)。
同意 @John 关于用例的观点,但我想指出,一旦您开始大量使用 webflow,您会发现自己编写了大量 xml 文件(因为在 webflow 中您指定了 xml 文件中的所有流)。这对我个人来说几乎是一个交易破坏者。

One problem that webflow solves efficiently is it cleanly separates (or at least it makes very hard to mix) business logic from your control logic.
Agree with @John on the use cases but I would like to point out that once you start using webflow heavily, you will find yourself writing a lot of xml files (since in webflow you specify all the flows in xml files). This is almost a deal breaker for me personally.

尐偏执 2024-09-18 06:38:03

我用过MVC和SWF。就我个人而言,我更喜欢 SWF 而不是 MVC,因为以下两个坚实的原因:

  1. Spring MVC 没有内置机制来跨同一浏览器中的多个选项卡进行会话控制。
  2. 在 SWF 中处理浏览器返回比在 MVC 中更容易。

I have used MVC and SWF. Personally I prefer SWF over MVC due to the following two solid reasons:

  1. Spring MVC has no built in mechanism for session control across multiple tabs in same browser.
  2. Handling browser go backs is easier in SWF than MVC.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文