官方文档:

网页跳转方法1:

  1. // 在一个Action中直接跳转到另外一个Action中,另外的Action接受一个opportunity对象,这里直接通过id传过去就行,约定规则,就可以获取对应内容。
  2. redirect controller: "opportunity", action: "show", id: opportunityContract.opportunity.id
 
1
  1. // 在一个Action中直接跳转到另外一个Action中,另外的Action接受一个opportunity对象,这里直接通过id传过去就行,约定规则,就可以获取对应内容。
2
  1. redirect controller: "opportunity", action: "show", id: opportunityContract.opportunity.id

网页跳转方法2:

  1. // Opportunity的show.gsp页面
  2. http://localhost:8080/opportunity/show/56829
  3. // RightCentification的Create Action:
  4. def create()
  5. {
  6. params['targetUri'] = request.getHeader("referer") // 存放到params里面
  7. respond new RightCertification(params)
  8. }
  9. // RightCentification的Create 页面,放到表单里面,再传递给后面Save Action:
  10. http://localhost:8080/rightCertification/create?opportunity=56829
  11. <g:hiddenField name="targetUri" value="${params?.targetUri}"></g:hiddenField>
  12. // RightCentification的 Save Action就可以直接跳转回Opportunity的show.gsp页面
  13. redirect url: params['targetUri']
  1. x
 
1
  1. // Opportunity的show.gsp页面
2
  1. http://localhost:8080/opportunity/show/56829
3
  1.  
4
  1. // RightCentification的Create Action:
5
  1. def create()
6
  1. {
7
  1. params['targetUri'] = request.getHeader("referer") // 存放到params里面
8
  1. respond new RightCertification(params)
9
  1. }
10
  1.  
11
  1. // RightCentification的Create 页面,放到表单里面,再传递给后面Save Action:
12
  1. http://localhost:8080/rightCertification/create?opportunity=56829
13
  1. <g:hiddenField name="targetUri" value="${params?.targetUri}"></g:hiddenField>
14
  1.  
15
  1. // RightCentification的 Save Action就可以直接跳转回Opportunity的show.gsp页面
16
  1. redirect url: params['targetUri']
17
  1.  

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. UVA 11404 简单LCS模型DP 字典序比较

    这个题目求某个字符串中含的最长的回文子串. 就是一个很简单的LCS模型吗,而且我不明白为什么网上这么多人都说仿照某写法把字符串先逆序一下,然后求LCS,我只想问一下,有必要吗? 直接按LCS的套路来就 ...

  2. spyder.app制作图标

    安装了 anaconda3, 自带spyder, 但是只能在terminal 中打开, 非常不友好. 模仿 anaconda3/目录下 Anaconda-Navigator.app, 制作了 spyd ...

  3. maxima安装&使用

    环境: mint 19 或者 > ubuntu 18 源代码安装的好处, 可以使用最新版. mint 19.1 下面, 利用apt 直接安装的maxima版本太老,不支持 draw 函数. lo ...

  4. ubuntu---【NVIDIA驱动 + CUDA 安装】不成功时的卸载方式

    NVIDIA驱动 与 CUDA 安装不成功时,可以卸载,检查相关问题(配置.兼容性等),重新安装.这里记录一下,卸载方式.

  5. LeetCode——48. 旋转图像

    给定一个 n × n 的二维矩阵表示一个图像. 将图像顺时针旋转 90 度. 说明: 你必须在原地旋转图像,这意味着你需要直接修改输入的二维矩阵.请不要使用另一个矩阵来旋转图像. 示例 1: 给定 m ...

  6. Mac技巧-如何切换至 Mac 地图应用的卫星视图模式

    如何切换至Mac地图应用的卫星视图模式?很多刚接触MAC电脑的小伙伴并不是很清楚,今天MACW小编就教教大家切换至 Mac 地图应用的卫星视图模式该怎么做.原文:https://www.macw.co ...

  7. XssFilter EscapeUtil

    package com.ruoyi.framework.config; import java.util.HashMap; import java.util.Map; import javax.ser ...

  8. 01.Java安装及环境变量的设置

    1.下载 https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 2.mac上安装及配 ...

  9. python学习笔记(31)——日志格式

  10. rabbitmq参考文档

    英文文档:http://www.rabbitmq.com/getstarted.html 中文文档:http://rabbitmq.mr-ping.com/ rabbitmq重启,消费者恢复,解决消费 ...