1
我開始使用Grails Web流程來實現嚮導。Grails webflow動態步驟名稱
checkStep {
action {
User user = springSecurityService.currentUser
if (springSecurityService.loggedIn){
def next = wizardService.getNextFlowStep(user)
switch (next) {
case step1:
step1()
break
...
}
}
on("step1").to "wizard_step1"
} // checkStep
wizard_step1() {
...
}
我想以更優雅的方式編寫第一步,例如基於「wizardService」,下一步將被確定。我還傾向於在運行時確定這些步驟,以便實際的步驟名稱和順序可以駐留在數據庫中。
感謝
使用此解決方案,您仍然需要明確列舉所有'on('foo') .to('bar')'選項(儘管如果事件和狀態名稱遵循某種結構,可以用for循環完成)。我認爲沒有辦法解決這個問題,在應用程序啓動時需要知道流的結構(狀態和轉換)。 [這個問題](http://stackoverflow.com/questions/11126683/grails-webflow-access-flow-scope-outside-of-action-or-transition-states/11168991#11168991)談到涉及子流程的類似情況。 –