这个 spring webflow 动作状态是如何执行的?

How could this spring webflow action state executed?

我看到了一个 spring 这样的网络流程。如您所见,有两个视图状态,它们都将被此流外部的链接调用。但是我不知道为什么每次激活这个流程时,总是会调用动作状态。我个人认为应该有一个入口标签。有什么想法吗?感谢您的帮助。

  <?xml version="1.0" encoding="UTF-8"?>
    <flow xmlns="http://www.springframework.org/schema/webflow"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="
            http://www.springframework.org/schema/webflow
            http://www.springframework.org/schema/webflow/spring-webflow.xsd">

        <action-state id="start">
            <evaluate expression="aaa.fsdf()"/>
            <evaluate expression="aaa.bbb()"/>
            <transition on="yes" to="viewone"/>
            <transition on="no" to="viewtwo"/>
        </action-state>

        <view-state id="viewone" view="web/ccc">
        </view-state>

        <view-state id="viewtwo" view="web/eee">
        </view-state>


        <end-state id="final" view="web/final">
        </end-state>

    </flow>

这就是流程在 Spring Webflow 中的工作方式。参见 documentation about flows

The first state defined becomes the flow's starting point.


此外,您不能直接调用流中的状态。假设您的流程名称为 "test-flow",位于名为 test-flow.xml

的文件中

当你通过URL调用流程时,使用yoursite.com/test-flow它将进入流程和流程的第一个状态。所以如果你想在流中调用特定的视图状态,你必须使用一些逻辑来将流引导到你想要的状态。 一种方法是传递一个参数,例如 yoursite.com/test-flow?test=1 并在您的流程中使用操作状态来检查该参数并转换到正确的视图状态。

这就是这里发生的事情,流程中的操作状态是起点,根据某些逻辑它将过渡到您的 viewoneviewtwo

希望这是有道理的