【发布时间】:2010-04-27 17:21:47
【问题描述】:
这是我第一次在 Grails 中使用 webflow,我似乎无法解决这个问题。
我有 3 个域类,它们的关联如下所示:
class A {
...
static hasMany = [ b : B ]
...
}
class B {
...
static belongsTo = [ a : A ]
static hasMany = [ c : C ]
...
}
class C {
...
static belongsTo = [ b : B ]
...
}
现在,GSP 通过 Javascript 与控制器通信(由于我使用了 Dojo)。当我尝试 remoteFunction 一个正常的动作时,我可以这样做:
def action1 = {
def anId = params.id
def currA = A.get(anId)
def sample = currA.b?.c // I can get all the way to 'c' without any problems
...
}
但是,我有一个 webflow,该操作的内容在 webflow 中......它看起来像这样:
def someFlow = {
...
someState {
on("next") {
def anId = params.id // this does NOT return a null value
def currA = A.get(anId) // this does NOT return a null value
def sample = currA.b // error already occurs here and I need to get 'c'!
}.to("somePage")
...
}
...
}
在这种情况下,它告诉我 b 不存在......所以我什至无法到达 'c'。有什么建议可以做什么??? 谢谢……真的绝望了……
【问题讨论】:
标签: javascript grails groovy