第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

猜你喜欢

转载自blog.csdn.net/u010393325/article/details/83957873
8.1