본문 바로가기
개발/spring

spring 회원 웹기능 조회

by 향유 2022. 11. 28.

교육자료

https://www.youtube.com/watch?v=wCCMoUatat8&list=PLumVmq_uRGHgBrimIp2-7MCnoPUskVMnd&index=18

 


@GetMapping("/members")
public String list(Model model){
    List<Member> members= memberService.findMembers();
    model.addAttribute("members",members);
    return "members/memberList";

}

 

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <title>Title</title>
</head>
<body>
<div class ="contaioner">
  <table
    <thead>
    <tr>
      <th>#</th>
      <th>이름</th>
    </tr>
    </thead>
    <tbody>
      <tr th:each="member: ${members}">
        <td th:text="${member.id}"></td>
        <td th:text="${member.name}"></td>
      </tr>
    </tbody>
</div>
</body>
</html>

데이터가 메모리에 저장 되어있기에 서버 껐다 키면 사라짐 

 

다음시간 DB 설치 및 사용방법 

댓글