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- ...
随机推荐
- Lombok(浅看,自用)
Lombok 首先是几个常用的注解(最常用到的方法,超简单的用) @Data @AllArgsConstructor @NoArgsConstructor public class Trial_Pro ...
- django初步了解(一)
安装django pip3 install django==版本号 创建一个djangp项目 django-admin startproject 项目名 目录介绍: 运行django项目: pytho ...
- asmx 、Web Service、Web API
asmx .Web Service.Web API asmx 是WEB服务文件 asmx.cs里有相关代码 属于B/S形式,用SOAP方式HTTP访问,用XML返回 可以返回基础类型和PUBLIC结构 ...
- C++-CodeForces-1307A/1307B/1307C
假装自己打比赛嘿嘿嘿 #include <bits/stdc++.h> using namespace std; ]; int main(){ for(cin>>t;t--;) ...
- 如何做好 Android 端音视频测试?
在用户眼中,优秀的音视频产品应该具有清晰.低延时.流畅.秒开.抗丢包.高音效等特征.为了满足用户以上要求,网易云信的工程师通过自建源站,在SDK端为了适应网络优化进行QoS优化,对视频编码器进行优化, ...
- 洛谷 1219:八皇后 (位运算 & DFS)
题目链接: https://www.luogu.org/problem/show?pid=1219#sub row:受上面的皇后通过列控制的位置 ld:受上面的皇后通过从右至左的斜对角线控制的位置 r ...
- 【资源分享】CS起源 V34.4044(经典版本)
*----------------------------------------------[下载区]----------------------------------------------* ...
- go基础_定时器
每间隔5s打印一句hello // time_ticker package main import ( "fmt" "time" ) func main() { ...
- LED Decorative Light Manufacturer - Decorative Lighting: Functionality And Aesthetics
Whether it is for general ambient lighting, task lighting or accent lighting, the decorative lightin ...
- td标签内容:换行和不换行设置
td标签内容:换行和不换行设置 固定td内容不换行:<td style="white-space:nowrap">内容</td>或<td nowrap ...