项目的搭建以在上节完成:使用 IDEA 中创建 SpringBoot-JPA 的 web 项目
1.搭建的构成这里不详细讲,详情参考上述文章。
2.CurdController:
1 | import com.chanchifeng.curd.model.User; |
3.在controller包中创建DefaultController:
1 | import org.springframework.stereotype.Controller; |
4.在templates中创建index.html:
1 |
|
5.在templates中创建curd文件夹,在curd文件夹内创建index.html:
1 |
|
6.在templates中的curd文件夹内创建update.html:
1 |
|
7.在浏览器中输入http://localhost:8080/curd/curdController/queryAll,测试功能:
Github:SpringBoot-JPA/curd