1. 程式人生 > >第8講 8.1 SpringBoot查詢findAll()

第8講 8.1 SpringBoot查詢findAll()

1,寫BookDao介面

      

    繼承jpa介面

    


2,BookController

    寫註解

    注入介面

    寫方法

        返回值ModelAndView,方法名:list()

        findAll()方法,

        檢視名字:bookList

    

 

 

3,bookList.ftl

    寫table,

    

        freemarker的遍歷,    

    <#list bookList as book>
    <tr>
        <td>${book.id}</td>
        <td>${book.name}</td>
        <td>${book.author}</td>
        <td></td>
    </tr>
    </#list>

4,資料庫寫測試資料

8.1__SpringBoot查詢findAll()

 

5,瀏覽器:

  http://localhost:8888/book/list