【问题标题】:Grails Property Expression instead of Domain Object in Web Flow?Grails 属性表达式而不是 Web Flow 中的域对象?
【发布时间】:2011-06-10 21:12:14
【问题描述】:

我们目前正在尝试使用 Grails Web Flows 构建一些东西。

我们在 Flow 中设置了一个对象(使用 flow.objectName = objectInstance),但是当我们尝试在 Flow 的下一步中访问它(使用 flow.objectName)时,没有设置 Object,而是在那里是一个org.codehaus.groovy.....PropertyExpression,它没有我们想要使用的方法。

我们用来设置和获取的代码在其他情况下有效,我们找不到任何差异。

  • 什么是属性表达式?
  • 我们做错了什么,Webflows 经常发生的任何线索或问题?

提前感谢您的宝贵时间。

【问题讨论】:

  • 举个例子会很有帮助,因为大多数 grails webflow 问题都与 dsl 语法相关。

标签: grails properties expression spring-webflow


【解决方案1】:

确保您的 Webflow DSL 语法正确。

例如

def someFlow = {
    eventAction {
       flow.value = someValue // This is incorrect
       action {
           flow.value = someValue // This is correct
       }
       on("success").to "eventDisplay"
    }

    eventDisplay {
       on("finish").to "end"
       flow.anotherValue = somethingElse // This usually causes the behavior you are seeing.
       // Proper way of setting flow.anotherValue
       on("finish2") {
           flow.anotherValue = somethingElse
       }.to "end"

    }

    end{}
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-14
    • 2016-06-17
    • 1970-01-01
    • 1970-01-01
    • 2023-03-30
    • 1970-01-01
    相关资源
    最近更新 更多