일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
- 2 > /dev/null
- 참조키
- Query
- EC2
- docker명령어
- subquery
- ㅔㄴ션
- 네이티브쿼리
- 추후정리
- 서브쿼리
- 예약
- 컨테이너실행
- 테스트
- 메소드명
- appspec
- AuthenticationEntryPoint
- 테스트메소드
- 외부키
- WeNews
- application.yml
- 적용우선순위
- ubuntu
- 검색
- 커밋메세지수정
- appspec.yml
- 포트
- foreignkey
- MySQL
- 메세지수정
- querydsl
- Today
- Total
제뉴어리의 모든것
Thymeleaf에서 링크에 동적 파라미터, 동적 경로 추가 하 본문
- 동적 파라미터 추가하기
----------------------------------------------------------------
사용예 :
body>
<ul>
<li th:each="dto : ${list}">
<a th:href="@{/sample/exView/(sno=${dto.sno})}" > [[${dto}]]</a>
</li>
</ul>
</body>
----------------------------------------------------------------
----------------------------------------------------------------
결과 :
<body>
<ul>
<li>
<a href="/sample/exView/?sno=1" > SampleDTO(sno=1, first=First..1, last=Last..1, regTime=2021-01-15T09:47:01.799899500)</a>
</li>
:
:
</ul>
</body>
----------------------------------------------------------------
- 동적 경로 추가하기
----------------------------------------------------------------
사용예 :
body>
<ul>
<li th:each="dto : ${list}">
<a th:href="@{/sample/exView/{sno}(sno=${dto.sno})}" > [[${dto}]]</a>
</li>
</ul>
</body>
----------------------------------------------------------------
----------------------------------------------------------------
결과 :
<body>
<ul>
<li>
<a href="/sample/exView/1" > SampleDTO(sno=1, first=First..1, last=Last..1, regTime=2021-01-15T09:50:04.046861900)</a>
</li>
:
:
</ul>
</body>
----------------------------------------------------------------
결론 :
th:href="@{/sample/exView/와 (sno=${dto.sno})}" 사이에 {sno}가 있고 없고에 따라 경로 or 파라미터 결정됨