我的控制器是如下因素:Grails的控制器传递参数
def participated = {
def temp = ConferenceUser.get(params.temp)
def prizes = Prizes.findAllByConferenceUser(temp) // find all rooms where current computer is
def subms = Submissions.findAllByConferenceUser(temp) // find all rooms where current computer is
[temp: temp, priz: prizes, subm: subms]
}
但不知何故,当我成功地更新会议的价值,我想回到初始页面(参加),但我不知道该怎么传回params.temp
。 (如果我做一个简单的重定向,作为控制器期待params.temp
,它会给我一个错误,因为我不能用null对象作为参数搜索奖品所以,想象我的更新控制器如下:
def update = {
def saveParamshere = params.temp
...
...
(code here)
...
...
redirect(action: "participated", params: [temp: saveParamshere])
}
如何成功返回到我的主页并通过params.temp
?
好吧,我是gona尝试这种方式。请举个小例子? – VictorArgentin 2011-05-26 21:25:49
两个请求的闪光范围?从来没有听说过...... – jjczopek 2011-05-26 21:28:20
是的,闪存范围为当前请求和下一个请求生存(即保留重定向)。因此,在更新操作中执行flash.temp = params.temp意味着您可以在重定向的操作中访问flash.temp。 – Chris 2011-05-27 09:36:51