【问题标题】:Action Implementation in Spring Webflow 2Spring Webflow 2 中的动作实现
【发布时间】:2012-09-16 17:59:54
【问题描述】:

我正在尝试实现这样的 SWF 操作:

@Component(value = "initializeProjectsTestingFormAction")
public class InitializeProjectsTestingFormAction implements Action {

    @Autowired
    private ProjectsBo projectsBo;

    @Override
    public Event execute(RequestContext requestContext) throws Exception {
        ProjectsTestingForm projectsTestingForm = (ProjectsTestingForm) requestContext.getFlowScope().get("projectsTestingForm");

        EndUse selectedEndUse = (EndUse) requestContext.getFlowScope().get("selectedEndUse");
        projectsTestingForm.setProjects(projectsBo.findImplementableProjectsForTesting(selectedEndUse));

        return new Event("", "initializeProjectsTestingFormAction");
    }
}

当流程调用动作时,它目前工作正常,但我对动作必须返回的事件感到有些不安。有谁知道 Event 是什么以及根据其值(源和 id)可能对流行为产生什么影响?

我正在阅读文档,但我完全无法理解并回答自己的问题:

http://static.springsource.org/spring-webflow/docs/2.3.x/javadoc-api/index.html http://static.springsource.org/spring-webflow/docs/2.3.x/javadoc-api/org/springframework/webflow/execution/Event.html

提前致谢。

【问题讨论】:

    标签: spring action implementation spring-webflow


    【解决方案1】:

    事件的id(构造函数的第二个参数)应对应于调用动作后应采取的转换的on属性。

    【讨论】:

    • 非常感谢您的回答,这是有道理的。那么构造函数的第一个参数source呢?该论点有什么用处,有什么影响?任何想法?谢谢。
    • 这是泛型 Java 超类 java.util.EventObject 的必需构造函数参数。不确定它在 webflow 上下文中的用途(如果有的话)。
    • 太好了,我会做一些测试来找出其他东西。您是否有 SWF Action 实现及其在流程中各自使用的示例?只是为了与我的操作方式形成对比,我的 Action 正在工作,但我希望 100% 确定正确使用 Action,因为我必须实现其中的一堆。谢谢。
    猜你喜欢
    • 1970-01-01
    • 2016-11-08
    • 2012-05-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-16
    • 1970-01-01
    相关资源
    最近更新 更多