IT/development

[thyemeleaf] get 방식 parameter값 붙이기

알 수 없는 사용자 2023. 4. 26. 21:31
반응형

코드로 대체함

<tr th:if="${#lists.size(list) > 0}" th:each="list : ${list}">
    <td th:text="${list.no}"></td>
    <td><a th:href="@{user/view(empId=${list.empId}, empSno=${list.empSno})}" th:text="${list.empNm}"></a></td>
    <td th:text="${list.empId}"></td>
</tr>
<a th:href="@{user/view(empId=${list.empId}, empSno=${list.empSno})}" th:text="${list.empNm}"></a>

아래와 같은 URL이 생성된다.(empId, empSno는 서버에서 가져온 값)

localhost:8080/user/view?empId=test&empSno=1(예시)

반응형