[개발] 프로그램 지식

[jstl, jsp] td 동적 줄바꿈 참고 코드

  • -
반응형

jsp화면에서 데이터를 보여줄때, 개수를 모르는 경우에 동적으로 보여주는 방법

<c:forEach var="result" items="${object}" varStatus="status">
    <c:if test="${status.index % 2 == 0 }">
        <tr>
    </c:if>
    <td class="td_right" colspan="2">
        <c:if test="${not empty result.colums}">
            <label class="blind" for=""></label>
            <input type="checkbox" id="" name=""  class="form-style" value="">
            ${result.colums}
            <label class="blind" for=""></label>
            <input type="text" id="" name=""  class="form-style" value=""  style="width:20%;">
            ${result.columsNm}
        </c:if>
    </td>
    <c:if test="${status.last }">
        </tr>
    </c:if>
</c:forEach>
<c:if test="${object.size()+1 % 2 != 0 }">
	<td colspan="2"></td>
</c:if>
반응형
Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.