Spring boot+Thymeleaf传参跳转
$.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传参跳转的更多相关文章
- springboot(十七):使用Spring Boot上传文件
上传文件是互联网中常常应用的场景之一,最典型的情况就是上传头像等,今天就带着带着大家做一个Spring Boot上传文件的小案例. 1.pom包配置 我们使用Spring Boot最新版本1.5.9. ...
- (转)Spring Boot(十七):使用 Spring Boot 上传文件
http://www.ityouknow.com/springboot/2018/01/12/spring-boot-upload-file.html 上传文件是互联网中常常应用的场景之一,最典型的情 ...
- Spring Boot(十七):使用Spring Boot上传文件
Spring Boot(十七):使用Spring Boot上传文件 环境:Spring Boot最新版本1.5.9.jdk使用1.8.tomcat8.0 一.pom包配置 <parent> ...
- 使用Spring Boot上传文件
原文:http://www.cnblogs.com/ityouknow/p/8298344.html 上传文件是互联网中常常应用的场景之一,最典型的情况就是上传头像等,今天就带着带着大家做一个Spri ...
- Spring Boot(十七):使用 Spring Boot 上传文件
上传文件是互联网中常常应用的场景之一,最典型的情况就是上传头像等,今天就带着带着大家做一个 Spring Boot 上传文件的小案例. 1.pom 包配置 我们使用 Spring Boot 版本 ...
- spring boot: thymeleaf模板引擎使用
spring boot: thymeleaf模板引擎使用 在pom.xml加入thymeleaf模板依赖 <!-- 添加thymeleaf的依赖 --> <dependency> ...
- spring boot 参数传递(spring boot 参数传数 arg0 每一个参数 arg0#{arg0},arg1 #{arg1})
spring boot 参数传数 arg0 每一个参数 arg0#{arg0},arg1 #{arg1} @Select("select * from sys_user where nam ...
- spring boot + thymeleaf 3 国际化
在给spring boot 1.5.6 + thymeleaf 3进行国际化时,踩了一个坑(其实不止一个). 现象: 看到了吧, 就是取值的key, 后面被加了_en_US 或 _zh_CN, 以及前 ...
- spring boot + Thymeleaf开发web项目
"Spring boot非常适合Web应用程序开发.您可以轻松创建自包含的HTTP应用.web服务器采用嵌入式Tomcat,或者Jetty等.大多数情况下Web应用程序将使用 spring- ...
随机推荐
- 第五十三篇 Linux相关——Web服务器
No.1. Apache基本操作 安装:sudo yum -y install httpd 启动:service httpd start 停止:service httpd stop 查看服务运 ...
- rke安装k8s cluster配置
rke安装k8s cluster配置 最简配置 cluster.yml nodes: - address: 192.168.0.103 user: lishikai role: [controlpla ...
- Git 从远端指定分支克隆代码到本地
不指定分支默认是master git clone + clone 地址 # 例如 git clone https://amc-msra.visualstudio.com/xxx/_xx/xxxxxx ...
- Oracle 11G在用EXP 导入、导出时,若有空表对导入导出中遇到的问题的解决
11G中有个新特性,当表无数据时,不分配segment,以节省空间 解决方法: 1.insert一行,再rollback就产生segment了. 该方法是在在空表中插入数据,再删除,则产生segmen ...
- nmonchart 分析.nmon监控数据成html展示
下载地址:http://nmon.sourceforge.net/pmwiki.php?n=Site.Nmonchart chart安装包:http://sourceforge.net/project ...
- Python代码混淆和加密技术
Python进行商业开发时, 需要有一定的安全意识, 为了不被轻易的逆向. 混淆和加密就有所必要了. 为了增加代码阅读的难度, 源代码的混淆非常必要, 一个在线的Python代码混淆网站. http: ...
- IntelliJ IDEA 2017.3尚硅谷-----设置项目文件编码
这也可以 R暂时显示 C转换
- 记一次if控制器的使用
1.添加if控制器 2.输入判断条件:常见的就是某个变量是不是等于某个值 3.或者用函数助手中的函数 每个版本jmeter函数助手的入口不同,我的直接在菜单上: 选择__jexl3,输入判断条件,点击 ...
- HADOOP_SECURE_DN_USER has been replaced by HDFS_DATANODE_SECURE_USER
这个问题可能是我第一个遇到吧,hadoop启动时WARNING: HADOOP_SECURE_DN_USER has been replaced by HDFS_DATANODE_SECURE_USE ...
- AcWing 861. 二分图的最大匹配 匈牙利算法
#include <cstring> #include <iostream> #include <algorithm> using namespace std; , ...