Spring boot + thymeleaf th:href带参跳转及接受
2021-03-08 02:30
标签:tail stp lan epo boot div ref ppi ble 后端( @PathVariable(name="recordId") int recordId ): 二、 前端(): 后端(@RequestParam(name="recordId") int recordId): Spring boot + thymeleaf th:href带参跳转及接受 标签:tail stp lan epo boot div ref ppi ble 原文地址:https://www.cnblogs.com/Sahara-Iceland/p/14210037.html一、
前端(:a th:href="@{‘/record_details/‘+${record.id}}" target="_blank">
i>img th:src="@{imgs/default.jpg}" alt="标题图片">i>
h2 th:text="${record.title}">Titleh2>
a>
@GetMapping("/record_details/{recordId}")
public String showRecordDetails(Model model, @PathVariable(name="recordId") int recordId) {
System.out.println("_______________________"+recordId+"______________________");
pens.Record record = recordRepository.findOne(recordId);
System.out.println(record);
model.addAttribute("recorddetail", record);
return "record_details";
}
a th:href="@{/record_details(recordId=${record.id})}" target="_blank">
i>img th:src="@{imgs/default.jpg}" alt="标题图片">i>
h2 th:text="${record.title}">Titleh2>
a>
@GetMapping("/record_details")
public String showRecordDetails(Model model, @RequestParam(name="recordId") int recordId) {
System.out.println("_______________________"+recordId+"______________________");
pens.Record record = recordRepository.findOne(recordId);
System.out.println(record);
model.addAttribute("recorddetail", record);
return "record_details";
}
上一篇:使用Retrofit2.9.0请求时报的错java.lang.NoSuchMethodError: No static method get(Ljava/lang/String;)Lokhttp3/H
下一篇:javascript 一02数组
文章标题:Spring boot + thymeleaf th:href带参跳转及接受
文章链接:http://soscw.com/index.php/essay/61608.html