官方文档:

网页跳转方法1:

// 在一个Action中直接跳转到另外一个Action中,另外的Action接受一个opportunity对象,这里直接通过id传过去就行,约定规则,就可以获取对应内容。
redirect controller: "opportunity", action: "show", id: opportunityContract.opportunity.id
 
1
// 在一个Action中直接跳转到另外一个Action中,另外的Action接受一个opportunity对象,这里直接通过id传过去就行,约定规则,就可以获取对应内容。
2
redirect controller: "opportunity", action: "show", id: opportunityContract.opportunity.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']
x
 
1
// Opportunity的show.gsp页面
2
http://localhost:8080/opportunity/show/56829
3

4
// RightCentification的Create Action:
5
def create()
6
{
7
    params['targetUri'] = request.getHeader("referer") // 存放到params里面
8
    respond new RightCertification(params)
9
}
10

11
// RightCentification的Create 页面,放到表单里面,再传递给后面Save Action:
12
http://localhost:8080/rightCertification/create?opportunity=56829
13
<g:hiddenField name="targetUri" value="${params?.targetUri}"></g:hiddenField>
14

15
//  RightCentification的 Save Action就可以直接跳转回Opportunity的show.gsp页面
16
redirect url: params['targetUri']
17

Grails Controller - redirect 方法的更多相关文章

  1. Grails Controller - respond 方法

    基本用法 官方文档:http://docs.grails.org/latest/ref/Controllers/respond.html 为当前 respond 语句所在 action 所对应的页面返 ...

  2. springmvc中controller内方法跳转forward?redirect?

    使用springmvc的controller的时候,碰到controller内方法的跳转的问题,记录下问题以及自己测试的过程. 场景: 业务执行更新操作之后返回列表页面,列表页面需默认展示查询的列表数 ...

  3. 在MVC里面使用Response.Redirect方法后记得返回EmptyResult

    在ASP.NET MVC中我们很多时候都会在拦截器和Controller中直接使用Response.Redirect方法做跳转,但是实际上Response.Redirect方法执行后ASP.NET并不 ...

  4. thinkphp3.2.3中U()方法和redirect()方法区别

    今天博主看3.1的教程,学着3.2,就遇到了这个坑,怎么就是不跳转呢,很纳闷!! 在thinkphp3.1 中 U()方法是可以执行跳转的(看视频教程里面是可以的,博主没有测试过). 但是在think ...

  5. 如何解决Response.Redirect方法传递汉字丢失或乱码问题?

    为了确保传递的汉字被正确地接收,可以在传值之前使用Server对象的UrlEncode方法对所传递的汉字进行URL编码.代码如下: String name = Server.UrlEncode(&qu ...

  6. 详解SpringMVC中Controller的方法中参数的工作原理[附带源码分析]

    目录 前言 现象 源码分析 HandlerMethodArgumentResolver与HandlerMethodReturnValueHandler接口介绍 HandlerMethodArgumen ...

  7. 重定向语句Response.Redirect()方法与Response.RedirectPermanent()对搜索引擎页面排名的影响

    在ASP.NET中,开发人员经常使用Response.Redirect()方法,用编程的手法,将对老的URL的请求转到新的URL上.但许多开发人员没有意识到的是,Response.Redirect() ...

  8. Navigation Controller 创建方法

    添加Navigation Controller的方法主要有两种: 第一种:主要是通过在storyboard中拖入Object library 中的Navigation Controller 第二种方法 ...

  9. 【异常处理】Springboot对Controller层方法进行统一异常处理

    Controller层方法,进行统一异常处理 提供两种不同的方案,如下: 方案1:使用 @@ControllerAdvice (或@RestControllerAdvice), @ExceptionH ...

随机推荐

  1. Python插件安装

    Python插件安装 1. 找到Python的安装目录. 打开CMD控制台输入 python 打开环境变量,找到Python安装路径. 进入 安装目录 下的 Scripts 目录 . 查看已安装的插件 ...

  2. LeetCode 687. Longest Univalue Path 最长同值路径 (C++/Java)

    题目: Given a binary tree, find the length of the longest path where each node in the path has the sam ...

  3. 图解:平衡二叉树,AVL树

    学习过了二叉查找树,想必大家有遇到一个问题.例如,将一个数组{1,2,3,4}依次插入树的时候,形成了图1的情况.有建立树与没建立树对于数据的增删查改已经没有了任何帮助,反而增添了维护的成本.而只有建 ...

  4. js 动画滚动到指定位置 ES6

    ### 开始 ### 写一个自动滚动过度到指定位置的一个函数 通过Class进行封装 /** * 滚动动画过度 * @param {Object} position 定位(只支持Y轴) * @para ...

  5. linux的vi编辑器中如何查找内容(关键字)

    按下”/“键,这时在状态栏(也就是屏幕左下脚)就出现了 “/” 然后输入你要查找的关键字敲回车就可以了. 找到相关文字以后: (1)按下小写n,向下查找 (2)按下大写N,向上查找

  6. matlab中画一条折线时怎样显示出每个点折点的数值

    举个例子: num=[5,44,62,154,264,365,398,480,619,705,762,728,669,726,890,731,707,696,558,509,444];date=[1. ...

  7. unity学习 5.x解包

    using System.Collections;using System.Collections.Generic;using UnityEngine; public class bundleload ...

  8. ubuntu14 编译tensorflow C++ 接口

    tensorflow1.11 bazel 0.15.2 protobuf 3.6.0 eigen 3.3.5 wget -t 0 -c https://github.com/eigenteam/eig ...

  9. IDEA查看接口的所有实现类

    查看实现类 接口下右键Diagrams->Show Diagram,选中接口右键Show Implementations 或接口下按Ctrl+H: 或接口类名左边按钮:

  10. nm命令介绍

    一.参考文章 网址1:https://linuxtools-rst.readthedocs.io/zh_CN/latest/tool/nm.html 参考2: man nm 参考3:<linux ...