标签:tail stp lan epo boot div ref ppi ble
一、
前端(<a th:href="@{‘/record_details/‘+${record.id}}" target="_blank"></a>:
<a th:href="@{‘/record_details/‘+${record.id}}" target="_blank"> <i><img th:src="@{imgs/default.jpg}" alt="标题图片"></i> <h2 th:text="${record.title}">Title</h2> </a>
后端( @PathVariable(name="recordId") int recordId ):
@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">):
<a th:href="@{/record_details(recordId=${record.id})}" target="_blank"> <i><img th:src="@{imgs/default.jpg}" alt="标题图片"></i> <h2 th:text="${record.title}">Title</h2> </a>
后端(@RequestParam(name="recordId") int recordId):
@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"; }
Spring boot + thymeleaf th:href带参跳转及接受
标签:tail stp lan epo boot div ref ppi ble
原文地址:https://www.cnblogs.com/Sahara-Iceland/p/14210037.html