1. Controller 소스 코드
@GetMapping("/")
public String list(Model model) {
List<BoardResponse.DTO> boardList = boardService.게시글목록보기();
model.addAttribute("models", boardList);
return "list";
}
2. list.mustache
<section>
<table border="1">
<tr>
<th>번호</th>
<th>제목</th>
<th></th>
</tr>
{{#models}}
<tr>
<td>{{id}}</td>
<td>{{title}}</td>
<td><a href="/board/{{id}}">상세보기</a></td>
</tr>
{{/models}}
</table>
</section>
Mustache에서 {{#model}} 블록은 model이 컬렉션일 때 자동으로 반복문을 처리합니다.
3. 브라우저 화면

Share article