인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

조재연's profile image
조재연

asked

Spring MVC Part 2 - Backend Web Development Utilization Technology

안녕하세요. 개인적으로 하다가 타임리프 관련 질문이 있어서 문의드립니다.

Written on

·

181

0

개인적으로 JSP 에서 타임리프로 변경하면서 진행하다가 잘 모르겠어서 문의드립니다.
Retrofit 을 사용해서 진행하고 있는데요. 기존 JSP 에서는 이렇게 진행을 했었는데요.
가령 타임리프로 이런식으로 해보았습니다. th:href 랑 th:src 쪽 문제같다고 저는 생각을 하는데요.
링크 표현식이 아니라서 @ 이거를 써주면 안되는거 같기는한데 찾아봐도 잘 모르겠어서 이렇게 문의 드립니다. (__)
    <table border="1" th:if="${image != null && image.documents.size() > 0}">
        <thead>
            <tr th:each="item, status : ${image}">
                <td th:if="${status.index % 6 == 0 && status.index + 1 % 6 == 0}">
                    <a th:href="@{item.docUrl}">
                        <img th:src="@{item.thumbnail_url}">
                    </a>
                </td>
            </tr>
        </thead>
    </table>
    <table th:unless="${image != null && image.documents.size() > 0}">

    </table>
<c:when test=${image != null && image.documents.size() > 0}">
       <table border="1">
            <c:forEach var="item" items="${image.documents}" varStatus="status">
                   <c:if test="${status.index % 6 == 0}">
                          <tr>
                   </c:if>
         
                   <td>
                            <a href="${item.docUrl}">
                                   <img src="${mite.thumbnail_url}" />
                            </a>
                    </td>

                   <c:if test=${status.index + 1 % 6 == 0}">
                         </tr>
                   </c:if>
             </c:forEach>
        </table>
</c:when>
springMVC

Answer 1

0

안녕하세요. 조재연님, 공식 서포터즈 Taewon David Hwang입니다:)

.

만약 재연님처럼 컨트롤러에서 뷰쪽으로 전달하는 변수를 사용하려면 th:src="${...}" 형태로 사용하시는 게 맞습니다.

.
감사합니다.

조재연님의 프로필 이미지
조재연
Questioner

그렇군요 감사합니다 !

조재연's profile image
조재연

asked

Ask a question