header.jsp

<li><a href="**/board/list**">게시판</a></li>

Controller

@Controller
@RequestMapping("/board/*")
public class BoardController {

	@Setter(onMethod_ = @Autowired)
	private BoardService boardService;

	@GetMapping("/list")
	public String list(Model model) {

		// board 테이블에서 전체글 리스트로 가져오기
		List<BoardVO> boardList = boardService.getBoards();
		int totalCnt = boardService.getTotalCnt(); // 전체 글개수 가져오기

		model.addAttribute("boardList", boardList);
		model.addAttribute("totalCnt", totalCnt);

		return "board/boardList";
	}

}

BoardService

public List<BoardVO> getBoards() {
		return boardMapper.getBoards();
	}

BoardMapper.java

List<BoardVO> getBoards();

BoardMapper.xml

<select id="getBoards" resultType="boardVO"> // 리턴은 리스트지만 본질은 boardVO 임을..
		<![CDATA[ 
			SELECT * FROM board ORDER BY num DESC
		]]>
	</select>

boardList.jsp

<c:choose>
	<c:when test="${totalCnt gt 0}"> <!-- 글개수가 기준이 됨 --!>
		<!-- page -> request -> session -> application 순으로 -->
		<c:forEach var="board" items="${boardList}">
			<tr onclick="location.href='/board/content?num=${board.num}'" style="cursor: pointer;">
				<td class="center-align">${board.num}</td>
				<td>${board.title}</td>
				<td class="center-align">${board.mbrid}</td>
				<td class="center-align"><fmt:formatDate value="${board.regDate}" pattern="yyyy.mm.dd" /></td>
				<td class="center-align">${board.readcnt}</td>
			</tr>

		</c:forEach>
	</c:when>
	
	<c:otherwise>
		<tr>
			<!-- 열 병합 -->
			<td colspan="5">게시판 글이 없습니다. </td>
		</tr>
	</c:otherwise>
</c:choose>