公式文書:
ジャンプページ方法1:
// 在一个Action中直接跳转到另外一个Action中,另外的Action接受一个opportunity对象,这里直接通过id传过去就行,约定规则,就可以获取对应内容。
redirect controller: "opportunity", action: "show", id: opportunityContract.opportunity.id
1
別のアクションアクション、ここではライン上で過去に介して直接ターゲット、IDパスを受け入れるための追加の機会アクションへの直接//ジャンプは、合意されたルールは、あなたが対応するコンテンツを取得することができます。
2
リダイレクト コントローラ:"チャンス"、アクション:"ショー"、ID:opportunityContract。機会。ID
ジャンプページ方法2:
// 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']
バツ
1
// show.gspページの機会
2
http:// localhostを:8080 /機会/ショー/ 56829
3
4
// RightCentificationは、アクションの作成的:
5
デフ 作成()
6
{
7
paramsは [ 'targetURI' ] = 要求。のgetHeader("リファラー")のparamsに格納される//
8
応答 新しい RightCertification(のparams)
9
}
10
11
// RightCentificationページを作成し、フォームの内部を入れ、[保存]アクションの後ろに渡さ:
12
http:// localhostを:8080 / rightCertification /作成する機会= 56829?
13
< G:のHiddenField 名= "targetUri" 値= "$ {paramsは.targetUri?}" > </ G:のHiddenField >
14
15
あなたが直接バックshow.gspの機会のページへジャンプすることができます// RightCentification保存アクション
16
リダイレクト URL:のparams [ 'targetUri' ]
17