官方文档:

网页跳转方法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. servlet-api api文档获取请求参数

    1.假如有个get请求后面带有的参数如下: a=b&a2=b2&a3=b3&a4=b4. 如果想获取所有的key,value.这个时候可以根据request的getQueryS ...

  2. Nginx和php交互的两种方式

    Unix socket 也叫IPC socket  也就是进程间通信套接字用于同一台主机上的不同进程间交换数据 TCP socket IP socket要利用主机的传输层(tcp),可以用于同一台主机 ...

  3. CVPR2019 | 超越Mask R-CNN!华科开源图像实例分割新方法MS R-CNN

    安妮 乾明 发自 凹非寺 本文转载自量子位(QbitAI) 实习生又立功了! 这一次,亮出好成绩的实习生来自地平线,是一名华中科技大学的硕士生. 他作为第一作者完成的研究Mask Scoring R- ...

  4. Vue.js——6.创建组件

    Vue组件组件就是为了拆分Vue实例的代码量,能够不同的功能定义不同的组件创建组件的方法 1. // 创建组件 let com1=Vue.extend({ template:'<h1>he ...

  5. springboot整合redis简单示例

    一.项目架构 二.项目内容 1.pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=&q ...

  6. 重载(overloading)和重写@Override

    一.重写:@Override 定义:字类方法覆盖父类方法,通俗来说就是方法里面的内容可以不一样,其他都一样. (1)必须保证权限大于等于父类的权限public>protetcted>默认& ...

  7. 计蒜客 蒜头君回家(有条件的BFS)

    蒜头君要回家,但是他家的钥匙在他的朋友花椰妹手里,他要先从花椰妹手里取得钥匙才能回到家.花椰妹告诉他:“你家的钥匙被我复制了很多个,分别放在不同的地方.” 蒜头君希望能尽快回到家中,他需要首先取得任意 ...

  8. 常用STL的常见用法

    //#pragma comment(linker, "/STACK:1024000000,1024000000") //#pragma GCC optimize(2) //#inc ...

  9. Teensy-HID攻击

    title date tags layut 渗透利器-Teensy(低配版BadUSB) 2018-09-25 kali post 准备工作 一块 Teensy2.0++ 的板子(淘宝一搜就有) Ar ...

  10. macOS更新失败解决

    下载离线更新包解决. https://support.apple.com/downloads/combo