<button th:myName="${cafe.id}" th:onclick="deleteCafe(this.getAttribute('myName'))">삭제</button>

1. th:변수명="${값}"으로 매개변수로 던지고 싶은 값을 지정해 준다.

2. 매개변수 자리에 this.getAttribute('변수명')으로 값을 전달해준다.

 

매개 변수에 다이렉트로 ${cafe.id}를 던지면 안들어가지므로 위의 방법을 사용해야 한다.

+ Recent posts