Controller 에서, 전달 할 Model, ModelAndView 이름을 resultList, 이름 필드 명 name, 전화번호 필드명을 phoneNum으로 지정 했다고 가정.




<table name="phoneNumList" border= "1">

    <colgroup>

        <col width="150px" />

        <col width="150px" />

    </colgroup>

    <thead>

        <tr>

            <td style="font-weight: bold;">이름</td>

            <td style="font-weight: bold;">전화번호</td>

        </tr>

    </thead>

    <tbody>

        <c:forEach items="${resultList}" var="List">

            <tr>

                <td>${List.name}</td>

                <td>${List.phoneNum}</td>

            </tr>

        </c:forEach>

    </tbody>

</table>



jsp 상단에 아래의 라이브러리 추가 


<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

+ Recent posts