$.ajax():

$.ajax({
type: "get",
url:"/public/inform",
async: true,
data: detailJson,
success:function (data) {
window.location.href = '/public/informDetail/'+data.id;
}
});

controller:

/**
* 下面两个方法服务于ajax跳转
*/
@RequestMapping(value = "/inform", method = RequestMethod.GET)
@ResponseBody
public Map inform(Inform detailJson){
HashMap<String,Object> resMap = new HashMap<>();
resMap.put("code",1);
resMap.put("id",detailJson.getId());
return resMap;
}
@RequestMapping(value = "/informDetail/{id}",method = RequestMethod.GET)
public String informDetail(Model model, @PathVariable("id") Integer id){
Inform inform = informService.selectInform(id);
model.addAttribute("detail", inform);
return "/informDetail";
}

新页面:

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>通知详情页</title>
<!-- 我其他页面都是../layui的,因为这个这个控制器类我写了@RequestMapping("/public"),方法写了@RequestMapping("//informDetail/{id}"),会导致资源不是访问http://localhost:8088/layui,而是访问成http://localhost:8088/public/layui -->
<link rel="stylesheet" href="../../layui/css/layui.css" type="text/css">
</head>
<body> <input th:value="${detail.getId()}"/> </body>
</html>

Spring boot+Thymeleaf传参跳转的更多相关文章

  1. springboot(十七):使用Spring Boot上传文件

    上传文件是互联网中常常应用的场景之一,最典型的情况就是上传头像等,今天就带着带着大家做一个Spring Boot上传文件的小案例. 1.pom包配置 我们使用Spring Boot最新版本1.5.9. ...

  2. (转)Spring Boot(十七):使用 Spring Boot 上传文件

    http://www.ityouknow.com/springboot/2018/01/12/spring-boot-upload-file.html 上传文件是互联网中常常应用的场景之一,最典型的情 ...

  3. Spring Boot(十七):使用Spring Boot上传文件

    Spring Boot(十七):使用Spring Boot上传文件 环境:Spring Boot最新版本1.5.9.jdk使用1.8.tomcat8.0 一.pom包配置 <parent> ...

  4. 使用Spring Boot上传文件

    原文:http://www.cnblogs.com/ityouknow/p/8298344.html 上传文件是互联网中常常应用的场景之一,最典型的情况就是上传头像等,今天就带着带着大家做一个Spri ...

  5. Spring Boot(十七):使用 Spring Boot 上传文件

      上传文件是互联网中常常应用的场景之一,最典型的情况就是上传头像等,今天就带着带着大家做一个 Spring Boot 上传文件的小案例. 1.pom 包配置 我们使用 Spring Boot 版本 ...

  6. spring boot: thymeleaf模板引擎使用

    spring boot: thymeleaf模板引擎使用 在pom.xml加入thymeleaf模板依赖 <!-- 添加thymeleaf的依赖 --> <dependency> ...

  7. spring boot 参数传递(spring boot 参数传数 arg0 每一个参数 arg0#{arg0},arg1 #{arg1})

    spring boot 参数传数 arg0 每一个参数 arg0#{arg0},arg1  #{arg1} @Select("select * from sys_user where nam ...

  8. spring boot + thymeleaf 3 国际化

    在给spring boot 1.5.6 + thymeleaf 3进行国际化时,踩了一个坑(其实不止一个). 现象: 看到了吧, 就是取值的key, 后面被加了_en_US 或 _zh_CN, 以及前 ...

  9. spring boot + Thymeleaf开发web项目

    "Spring boot非常适合Web应用程序开发.您可以轻松创建自包含的HTTP应用.web服务器采用嵌入式Tomcat,或者Jetty等.大多数情况下Web应用程序将使用 spring- ...

随机推荐

  1. django 自定义url转换器

    django内置的url转换器,包括有int.str.uuid等等.但是有时候他们不能满足我们的需求,因此就需要使用自定义url转换器.自定义url转换器的五步:1.定义一个类,直接继承自object ...

  2. [刷题] Leetcode算法 (2020-2-27)

    1.最后一个单词的长度(很简单) 题目: 给定一个仅包含大小写字母和空格 ' ' 的字符串 s,返回其最后一个单词的长度. 如果字符串从左向右滚动显示,那么最后一个单词就是最后出现的单词. 如果不存在 ...

  3. Linux - Shell - #!/bin/bash

    概述 简单解释一下 shell 脚本卡头的 #!/bin/bash 水一篇, 少一篇 背景 shell 脚本中的注释 通常是 以# 卡头的行 但是有时候执行 shell 的时候, 会有这种内容 #!/ ...

  4. unittest的命令执行

    命令窗口执行: 1.可以在命令窗口下执行单个module.class.method python -m unittest test_module1 test_module2 python -m uni ...

  5. linux 安装tar 命令

    yum install -y tar 查看版本 tar --version

  6. pandas 数据可视化之折线图

    官网地址:https://openpyxl.readthedocs.io/en/stable/charts/line.html#id1 openpyxl+pandas # coding=utf-8 i ...

  7. 对C#继承、多态的理解

    11月3日 阴天 前两天看某位大牛写的程序,对于C#多态有困惑,今天一大早来查阅了不少资料,自认为有了一个基本的认知,记录下来,一扫今天这阴霾的天气 ------------------------- ...

  8. 无需QQ成为好友,直接启动QQ客户端聊天

    <a style="color:#fff; margin-left:8px; padding-top:12px;" target="_parent" hr ...

  9. opencv:图像轮廓发现

    #include <opencv2/opencv.hpp> #include <iostream> using namespace cv; using namespace st ...

  10. linux中history加入显示时间命令代码

    source 空格 配置文件,则配置立即生效,这里的soruce也可以用英文状态下的点即“.”代替 历史命令history -w将现在的命令记录写入到history里面 如果在history里面加上时 ...