嗯,自从我做了一个流程以来已经有一段时间了,你的例子很简单(我希望只是为了作为一个例子)。
您缺少的是流程中的初始操作。请记住,作为您的 showProducts 的“查看”流程操作只是说明您的 showProducts gsp POST 时要执行的操作。将您发送到 showProducts 的操作应该创建要在 showProducts.gsp 中使用的模型
def ShoppingCartFlow = {
initialize {
action { // note this is an ACTION flow task
// perform some code
[ model: modelInstance ] // this model will be used in showProducts.gsp
}
on ("success").to "showProducts"
// it's the above line that sends you to showProducts.gsp
}
showProducts {
// note lack of action{} means this is a VIEW flow task
// you'll get here when you click an action button from showProducts.gsp
on("checkout").to "enterPersonalDetails"
on("continueShopping").to "displayCatalogue"
}
// etc. (you'll need an enterPersonalDetails task,
// displayCatalogue task, and they
// should both be ACTION tasks)
}
说得通?