(FrontController.java)
Query String (@RequestParam) "?"
url:
http://localhost:8080/view/service/setting?serviceId=3
@GetMapping("/view/service/setting")
public String viewService2(@RequestParam("serviceId") Long serviceId) {
return "view/service-setting";
}
$('#service-table tbody').on('click', '.replace ', function () {
var data = $('#service-table').DataTable().row($(this).parents('tr')).data();
const serviceId = data.serviceId;
console.log(serviceId);
location.href=`/view/service/setting?serviceId=${serviceId}`;
});
URL 변수 (@PathVariable)
url:
http://localhost:8080/view/service/setting/3
@GetMapping("/view/service/setting")
public String viewService2(@RequestParam("serviceId") Long serviceId) {
return "view/service-setting";
}
$('#service-table tbody').on('click', '.replace ', function () {
var data = $('#service-table').DataTable().row($(this).parents('tr')).data();
const serviceId = data.serviceId;
console.log(serviceId);
location.href=`/view/service/setting/${serviceId}`;
});