$.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. 常见python面试题

    1,简述列举了解的编程语言及语言间的区别? Python 解释型语言,代码简洁,易懂 C语言 编译型语言,底层语言 c++ 编译型语言,在C语言基础上加了面向对象 Java 混合型语言,可拓展性高 G ...

  2. 在Linux系统上安装配置ant环境

    1.从官网http://ant.apache.org/bindownload.cgi下载tar.gz版ant到本地电脑上 2.通过WinSCP工具将本地电脑上的ant压缩包上传至Linux服务器的/u ...

  3. How to make mail more effectively?

    1.What does your reader need to know? 2.What does your reader know already? 3.Will your reader be ab ...

  4. Spark 并行计算模型:RDD

    Spark 允许用户为driver(或主节点)编写运行在计算集群上,并行处理数据的程序.在Spark中,它使用RDDs代表大型的数据集,RDDs是一组不可变的分布式的对象的集合,存储在executor ...

  5. C#应用程序部署到集群若干问题

    1. MemoryCache中的缓存在集群中的每个节点不能同步 解决方案: A. 将缓存内容迁移到系统外部的Redis缓存 B. 在使用MemoryCache的时候设置过期时间(当对数据同步要求不是那 ...

  6. 实现手写体 mnist 数据集的识别任务

    实现手写体 mnist 数据集的识别任务,共分为三个模块文件,分别是描述网络结构的前向传播过程文件(mnist_forward.py). 描述网络参数优化方法的反向传播 过 程 文件 ( mnist_ ...

  7. 【 SSH 配置参考】

    applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xm ...

  8. cnblogs在手机端显示的一些坑

    目前在网上搜了个博皮,很高大上,感兴趣的朋友可以看一下,但是在手机端显示这些html5代码有很多缺陷: 1. h1.h2只能显示一行,如果字数太多,则会被隐藏 就像你现在看到的,h1原本内容为: 目前 ...

  9. nginx.conf nginx反向代理配置文件

    nginx反向代理配置文件 nginx.conf proxy_default.conf proxy.conf vhost/*.conf upstream/*.conf cache/*.conf ngi ...

  10. Go错误

    1. error package main import ( "errors" "fmt" ) func main() { /* error:内置的数据类型,内 ...