// 在一个Action中直接跳转到另外一个Action中,另外的Action接受一个opportunity对象,这里直接通过id传过去就行,约定规则,就可以获取对应内容。
redirect controller: "opportunity", action: "show", id: opportunityContract.opportunity.id
// 在一个Action中直接跳转到另外一个Action中,另外的Action接受一个opportunity对象,这里直接通过id传过去就行,约定规则,就可以获取对应内容。
redirect controller: "opportunity", action: "show", id: opportunityContract.opportunity.id
// Opportunity的show.gsp页面
http://localhost:8080/opportunity/show/56829
// RightCentification的Create Action:
def create()
{
params[‘targetUri‘] = request.getHeader("referer") // 存放到params里面
respond new RightCertification(params)
}
// RightCentification的Create 页面,放到表单里面,再传递给后面Save Action:
http://localhost:8080/rightCertification/create?opportunity=56829
<g:hiddenField name="targetUri" value="${params?.targetUri}"></g:hiddenField>
// RightCentification的 Save Action就可以直接跳转回Opportunity的show.gsp页面
redirect url: params[‘targetUri‘]
x
// Opportunity的show.gsp页面
http://localhost:8080/opportunity/show/56829
// RightCentification的Create Action:
def create()
{
params[‘targetUri‘] = request.getHeader("referer") // 存放到params里面
respond new RightCertification(params)
}
// RightCentification的Create 页面,放到表单里面,再传递给后面Save Action:
http://localhost:8080/rightCertification/create?opportunity=56829
<g:hiddenField name="targetUri" value="${params?.targetUri}"></g:hiddenField>
// RightCentification的 Save Action就可以直接跳转回Opportunity的show.gsp页面
redirect url: params[‘targetUri‘]
Grails Controller - redirect 方法
原文:https://www.cnblogs.com/duchaoqun/p/11834097.html