功能列表
一、用spring boot搭建的后端框架
二、页面渲染在后端,用的是thymeleaf模版引擎
三、前端使用angularJs实现数据视图的双向绑定,并且用的angular自带的resource模块请求restful接口
四、提供了提交数据的页面和相关接口
五、提供了多条件查询的页面和相关接口
六、提供了查询结果匹配高亮显示,分页查询等功能
项目目录一览
一、用spring boot搭建的后端框架
idea创建spring boot项目很方便的,这里我就不多说了。
二、页面渲染在后端,用的是thymeleaf模版引擎
thymeleaf模版的引入,pox.xml中添加如下依赖
<!-- thymeleaf -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
页面类型为.html文件,html文档的标签内添加xmlns:th="http://www.thymeleaf.org"
,如下所示:
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
三、前端使用angularJs实现数据视图的双向绑定,并且用的angular自带的resource模块请求restful接口
因为页面渲染在服务端,所以angular请求的模板视图需要做相应的处理,后端controller内添加如下代码:
@GetMapping(value = {
"/fragments/add-data", "/fragments/search-data"})
public String indexIncludePage(HttpServletRequest request) {
String path = request.getServletPath();
return path.substring(0, path.length() - 5);
}
以上表示前端请求的这两个/fragments/add-data,/fragments/search-data
视图经服务端渲染后返回给前端调用者。
以下为angular的resource模块的restful风格接口调用:
/** 自定义 Person 服务 */
.factory('Person', function ($resource) {
var ctx = window.qbian._ctx;
return $resource(ctx + '/person', {}, {
submit: {
method: 'POST' ,
url: ctx +