$.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之路之线程,进程,协程2

    一.线程 1.创建线程 2.主线程是否等待子线程 t.setDaemon(Ture/False):默认是false,等待子线程完成,ture,表示不等待子线程结束 3.主线程等待,子线程执行 join ...

  2. C++-POJ1021-2D-Nim[hash]

    哈希,对于每个点哈希一次 哈希的方式:该点到联通分量边界(上下左右)的距离和 然后分别对两个图的n个点按hash值排序,判断是否相等即可 #include <set> #include & ...

  3. 使用 navigator.sendBeacon() 上报数据

    http://kaifage.com/notes/76/navigator-sendBeacon.html 如某些统计系统,在页面unload时,如果要上报当前数据,采用xhr的同步上报方式,会阻塞当 ...

  4. winform学习(5)MDI窗体

    SDI窗体 single document interface 单文档界面,即单个简单的窗体 MDI窗体 multiple document interface 多文档界面(主窗体与子窗体的关系,避免 ...

  5. window10配置远程虚拟机window7上的mysql5.7数据源

    原文链接:http://www.xitongcheng.com/jiaocheng/win10_article_18644.html windows10系统用户想要在电脑中设置ODBC数据源,于是手动 ...

  6. Python 数据分析实战 | 用数据带你回顾乔丹的职业生涯

    乔丹是联盟上下公认的历史第一人,芝加哥公牛在他带领下几乎统治了上世纪 90 年代 NBA 整整 10 年,包括分别在 91-93 赛季和 96-98 赛季拿下的两次三连冠,要知道,NBA72 年历史上 ...

  7. 计算机网络 - TCP_NODELAY 和 TCP_CORK, TCP_NOPUSH

    参考 https://www.cnblogs.com/biyeymyhjob/p/4670502.html https://stackoverflow.com/questions/3761276/wh ...

  8. dw选择器

    选择器并没有一个固定的定义,在某种程度上说,jQuery的选择器和样式表中的选择器十分相似.选择器具有如下特点:1.简化代码的编写2.隐式迭代3.无须判断对象是否存在jQuery 的选择器可谓之强大无 ...

  9. bugku 好多压缩包

    https://www.cnblogs.com/WangAoBo/p/6951160.html

  10. java后台接受不到vue传的参数

    @RequestMapping(value = "/delBelowImg") @Transactional public R delBelowFile(@RequestParam ...