一:新建项目(下面的几乎属于公共的方法,不需要改动)

1.结构

  

  

2.添加lib

3.配置web.xml

 <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>SpringMvcCRUD</display-name>
<!-- 配置DispatchServlet -->
<servlet>
<servlet-name>DispatchServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:springmcv.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- 表示所有的请求都会走DispatcherServlet -->
<servlet-mapping>
<servlet-name>DispatchServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping> <!-- 配置过滤器 ,把POST请求转为DELETE,PUT请求-->
<filter>
<filter-name>HiddenHttpMethodFilter</filter-name>
<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>HiddenHttpMethodFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>

4.配置springmvc.xml

 <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">
<!-- 配置自定义扫描的包 -->
<context:component-scan base-package="com.spring.it" ></context:component-scan> <!-- 配置视图解析器 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>

5.实体类Department

 package com.spring.it.enties;

 public class Department {

     private Integer id;
private String departmentName; public Department() { } public Department(int i, String string) {
this.id = i;
this.departmentName = string;
} public Integer getId() {
return id;
} public void setId(Integer id) {
this.id = id;
} public String getDepartmentName() {
return departmentName;
} public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
} @Override
public String toString() {
return "Department [id=" + id + ", departmentName=" + departmentName
+ "]";
} }

6.实体类Employee

 package com.spring.it.enties;

 import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.NumberFormat; public class Employee { private Integer id;
private String lastName;
private String email;
//1 male, 0 female
private Integer gender;
private Department department; public Employee(Integer id, String lastName, String email, Integer gender,
Department department) {
super();
this.id = id;
this.lastName = lastName;
this.email = email;
this.gender = gender;
this.department = department;
} public Employee() { }
public Integer getId() {
return id;
} public void setId(Integer id) {
this.id = id;
} public String getLastName() {
return lastName;
} public void setLastName(String lastName) {
this.lastName = lastName;
} public String getEmail() {
return email;
} public void setEmail(String email) {
this.email = email;
} public Integer getGender() {
return gender;
} public void setGender(Integer gender) {
this.gender = gender;
} public Department getDepartment() {
return department;
} public void setDepartment(Department department) {
this.department = department;
} @Override
public String toString() {
return "Employee [id=" + id + ", lastName=" + lastName + ", email=" + email + ", gender=" + gender
+ ", department=" + department + "]";
} }

7.Dao---DepartmentDao

 package com.spring.it.dao;

 import java.util.Collection;
import java.util.HashMap;
import java.util.Map; import org.springframework.stereotype.Repository;
import com.spring.it.enties.Department; @Repository
public class DepartmentDao { private static Map<Integer, Department> departments = null; static{
departments = new HashMap<Integer, Department>(); departments.put(101, new Department(101, "D-AA"));
departments.put(102, new Department(102, "D-BB"));
departments.put(103, new Department(103, "D-CC"));
departments.put(104, new Department(104, "D-DD"));
departments.put(105, new Department(105, "D-EE"));
} public Collection<Department> getDepartments(){
return departments.values();
} public Department getDepartment(Integer id){
return departments.get(id);
} }

8.EmployeeDao

 package com.spring.it.dao;

 import com.spring.it.enties.Department;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.spring.it.enties.Employee;
@Repository
public class EmployeeDao { private static Map<Integer, Employee> employees = null; @Autowired
private DepartmentDao departmentDao; static{
employees = new HashMap<Integer, Employee>(); employees.put(1001, new Employee(1001, "E-AA", "aa@163.com", 1, new Department(101, "D-AA")));
employees.put(1002, new Employee(1002, "E-BB", "bb@163.com", 1, new Department(102, "D-BB")));
employees.put(1003, new Employee(1003, "E-CC", "cc@163.com", 0, new Department(103, "D-CC")));
employees.put(1004, new Employee(1004, "E-DD", "dd@163.com", 0, new Department(104, "D-DD")));
employees.put(1005, new Employee(1005, "E-EE", "ee@163.com", 1, new Department(105, "D-EE")));
} private static Integer initId = 1006; public void save(Employee employee){
if(employee.getId() == null){
employee.setId(initId++);
} employee.setDepartment(departmentDao.getDepartment(employee.getDepartment().getId()));
employees.put(employee.getId(), employee);
} public Collection<Employee> getAll(){
return employees.values();
} public Employee get(Integer id){
return employees.get(id);
} public void delete(Integer id){
employees.remove(id);
}
}

二:展示所有的员工---查看操作

1.Controller--EmployeeHander

 package com.spring.it.handlers;

 import java.util.Map;

 import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import com.spring.it.dao.EmployeeDao; @Controller
public class EmployeeHander {
@Autowired(required=true)
private EmployeeDao employeeDao; @RequestMapping("/emps")
public String list(Map<String,Object> map) {
System.out.println("====");
map.put("employee", employeeDao.getAll());
return "list";
}
}

2.首页index.jsp

 <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<br>
<a href="emps">list emps</a>
</body>
</html>

3.list.jsp

 <%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
This Is All Employee
<c:if test="${empty requestScope.employee }">
没有任何的员工信息
</c:if>
<c:if test="${!empty requestScope.employee }">
<table border="1" cellpadding="10" cellspacing="0">
<tr> <!-- id lastName email gender department -->
<th>ID</th>
<th>LastName</th>
<th>Email</th>
<th>Gender</th>
<th>Department</th>
<th>Edit</th>
<th>Delete</th>
</tr>
<c:forEach items="${requestScope.employee }" var="emp">
<tr>
<td>${emp.id}</td>
<td>${emp.lastName}</td>
<td>${emp.email}</td>
<td>${emp.gender==0?'Female':'Male'}</td>
<td>${emp.department.departmentName}</td>
<td><a href="">Edit</a></td>
<td><a href="">Delete</a></td>
</tr>
</c:forEach>
</table>
</c:if>
</body>
</html>

4.效果

  

三:添加操作

1.controller

  主要是增加了input与save操作。

 package com.spring.it.handlers;

 import java.util.Map;

 import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import com.spring.it.dao.DepartmentDao;
import com.spring.it.dao.EmployeeDao;
import com.spring.it.enties.Department;
import com.spring.it.enties.Employee; @Controller
public class EmployeeHander {
@Autowired(required=true)
private EmployeeDao employeeDao; @Autowired(required=true)
private DepartmentDao departmentDao; /**
* 保存,是submit提交过来的请求,属于Post请求
*/
@RequestMapping(value="/emp",method=RequestMethod.POST)
public String save(Employee employee) {
employeeDao.save(employee);
return "redirect:/emps";
} /**
* 跳转到input页面,用于添加员工,是Get请求
*/
@RequestMapping(value="/emp",method=RequestMethod.GET)
public String input(Map<String,Object> map) {
map.put("department", departmentDao.getDepartments());
//因为form表单的原因,默认一定要回显,第一次尽进来需要传入一个值
map.put("employee", new Employee());
return "input";
} /**
* 展示所有的员工
*/
@RequestMapping("/emps")
public String list(Map<String,Object> map) {
System.out.println("====");
map.put("employee", employeeDao.getAll());
return "list";
}
}

2.input.jsp

 <%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ page import="java.util.Map"%>
<%@ page import="java.util.HashMap"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<!-- id lastName email gender department -->
<!-- modelAttribute默认的bean是command,需要改成对应的bean -->
<form:form action="emp" method="POST" modelAttribute="employee">
LastName:<form:input path="lastName"/><br>
Email:<form:input path="email"/><br>
<%
Map<String,String> genders=new HashMap();
genders.put("1", "Male");
genders.put("0", "Female");
request.setAttribute("genders", genders);
%>
Gender:<form:radiobuttons path="gender" items="${genders}"/><br>
Department:<form:select path="department.id"
items="${department}" itemLabel="departmentName" itemValue="id"></form:select><br>
<input type="submit" values="Submit">
</form:form>
</body>
</html>

3.效果

  

  

4.PS---form表单

  使用的是spring form表单,在input中需要引入标签。

  

  

四:删除操作

1.修改list.jsp

  因为这个时候的list.jsp的delete按钮的连接还是空的,需要补充进去。

  这个get不能直接转换成delete操作,所以需要借助js。

 <%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<script type="text/javascript" src="scripts/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
$(function(){
$(".delete").click(function(){
var href = $(this).attr("href");
$("form").attr("action", href).submit();
return false;
})
})
</script>
</head>
<body>
<form action="" method="POST">
<input type="hidden" name="_method" value="DELETE">
</form> This Is All Employee
<c:if test="${empty requestScope.employee }">
没有任何的员工信息
</c:if>
<c:if test="${!empty requestScope.employee }">
<table border="1" cellpadding="10" cellspacing="0">
<tr> <!-- id lastName email gender department -->
<th>ID</th>
<th>LastName</th>
<th>Email</th>
<th>Gender</th>
<th>Department</th>
<th>Edit</th>
<th>Delete</th>
</tr>
<c:forEach items="${requestScope.employee }" var="emp">
<tr>
<td>${emp.id}</td>
<td>${emp.lastName}</td>
<td>${emp.email}</td>
<td>${emp.gender==0?'Female':'Male'}</td>
<td>${emp.department.departmentName}</td>
<td><a href="">Edit</a></td>
<td><a href="emp/${emp.id}" class="delete">Delete</a></td>
</tr>
</c:forEach>
</table>
</c:if>
<br><br>
<a href="emp">Add New Employee</a>
</body>
</html>

2.controller

 package com.spring.it.handlers;

 import java.util.Map;

 import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import com.spring.it.dao.DepartmentDao;
import com.spring.it.dao.EmployeeDao;
import com.spring.it.enties.Department;
import com.spring.it.enties.Employee; @Controller
public class EmployeeHander {
@Autowired(required=true)
private EmployeeDao employeeDao; @Autowired(required=true)
private DepartmentDao departmentDao; /**
* 删除操作
*/
@RequestMapping(value="/emp/{id}",method=RequestMethod.DELETE)
@ResponseBody
public String delete(@PathVariable("id") Integer id) {
employeeDao.delete(id);
return "redirect:/emps";
} /**
* 保存,是submit提交过来的请求,属于Post请求
*/
@RequestMapping(value="/emp",method=RequestMethod.POST)
public String save(Employee employee) {
employeeDao.save(employee);
return "redirect:/emps";
} /**
* 跳转到input页面,用于添加员工,是Get请求
*/
@RequestMapping(value="/emp",method=RequestMethod.GET)
public String input(Map<String,Object> map) {
map.put("department", departmentDao.getDepartments());
//因为form表单的原因,默认一定要回显,第一次尽进来需要传入一个值
map.put("employee", new Employee());
return "input";
} /**
* 展示所有的员工
*/
@RequestMapping("/emps")
public String list(Map<String,Object> map) {
System.out.println("====");
map.put("employee", employeeDao.getAll());
return "list";
}
}

 

3.处理静态资源

  因为springmvc拦截所有的请求,所以静态资源也被拦截,但是静态资源没有被映射。

  但是静态资源是不需要映射的。

  解决方式是在springmvc的配置文件中配置default-servlet-handler,但是以前的功能又出现了问题,这个时候需要添加上annotation-driven

 <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">
<!-- 配置自定义扫描的包 -->
<context:component-scan base-package="com.spring.it" ></context:component-scan> <!-- 配置视图解析器 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
</bean> <mvc:default-servlet-handler/>
<mvc:annotation-driven></mvc:annotation-driven>
</beans>

4.效果

  

五:修改

1.修改list

  Edit的连接需要修改。

 <%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<script type="text/javascript" src="scripts/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
$(function(){
$(".delete").click(function(){
var href = $(this).attr("href");
$("form").attr("action", href).submit();
return false;
})
})
</script>
</head>
<body>
<form action="" method="POST">
<input type="hidden" name="_method" value="DELETE">
</form> This Is All Employee
<c:if test="${empty requestScope.employee }">
没有任何的员工信息
</c:if>
<c:if test="${!empty requestScope.employee }">
<table border="1" cellpadding="10" cellspacing="0">
<tr> <!-- id lastName email gender department -->
<th>ID</th>
<th>LastName</th>
<th>Email</th>
<th>Gender</th>
<th>Department</th>
<th>Edit</th>
<th>Delete</th>
</tr>
<c:forEach items="${requestScope.employee}" var="emp">
<tr>
<td>${emp.id}</td>
<td>${emp.lastName}</td>
<td>${emp.email}</td>
<td>${emp.gender==0?'Female':'Male'}</td>
<td>${emp.department.departmentName}</td>
<td><a href="emp/${emp.id}">Edit</a></td>
<td><a href="emp/${emp.id}" class="delete">Delete</a></td>
</tr>
</c:forEach>
</table>
</c:if>
<br><br>
<a href="emp">Add New Employee</a>
</body>
</html>

2.java

  主要有三个部分:

  弹出到修改的页面函数

  更新的函数

  保证lastname不改变的函数。

 package com.spring.it.handlers;

 import java.util.Map;

 import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.view.RedirectView; import com.spring.it.dao.DepartmentDao;
import com.spring.it.dao.EmployeeDao;
import com.spring.it.enties.Department;
import com.spring.it.enties.Employee; @Controller
public class EmployeeHander {
@Autowired(required=true)
private EmployeeDao employeeDao; @Autowired(required=true)
private DepartmentDao departmentDao; /**
* 使得lastName不被修改,使用ModelAttribute
*/
@ModelAttribute
public void getEmployee(@RequestParam(value="id",required=false) Integer id,Map<String,Object> map) {
if(id!=null) {
map.put("employee", employeeDao.get(id));
}
} /**
* 编辑,主要是提交
*/
@RequestMapping(value="/emp",method=RequestMethod.PUT)
public String update(Employee employee) {
employeeDao.save(employee);
return "redirect:/emps";
} /**
* 编辑,主要是跳转到要编辑的页面
*/
@RequestMapping(value="/emp/{id}",method=RequestMethod.GET)
public String input(@PathVariable("id") Integer id,Map<String,Object> map) {
map.put("department", departmentDao.getDepartments());
//回显
map.put("employee", employeeDao.get(id));
return "input";
} /**
* 删除操作
*/
@RequestMapping(value="/emp/{id}",method=RequestMethod.DELETE)
@ResponseBody
public String delete(@PathVariable("id") Integer id) {
employeeDao.delete(id);
return "redirect:/emps";
} /**
* 保存,是submit提交过来的请求,属于Post请求
*/
@RequestMapping(value="/emp",method=RequestMethod.POST)
public String save(Employee employee) {
employeeDao.save(employee);
return "redirect:/emps";
} /**
* 跳转到input页面,用于添加员工,是Get请求
*/
@RequestMapping(value="/emp",method=RequestMethod.GET)
public String input(Map<String,Object> map) {
map.put("department", departmentDao.getDepartments());
//因为form表单的原因,默认一定要回显,第一次尽进来需要传入一个值
map.put("employee", new Employee());
return "input";
} /**
* 展示所有的员工
*/
@RequestMapping("/emps")
public String list(Map<String,Object> map) {
System.out.println("====");
map.put("employee", employeeDao.getAll());
return "list";
}
}

3.input页面

  根据id是否存在,决定lastname是否显示。

  id决定是否进行走PUT。

 <%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ page import="java.util.Map"%>
<%@ page import="java.util.HashMap"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<!-- id lastName email gender department -->
<!-- modelAttribute默认的bean是command,需要改成对应的bean -->
<form:form action="${pageContext.request.contextPath}/emp" method="POST" modelAttribute="employee">
<!-- lastName在修改的时候,不能被显示 -->
<c:if test="${employee.id == null}">
LastName:<form:input path="lastName"/><br>
</c:if>
<c:if test="${employee.id != null}">
<form:hidden path="id"/>
<!-- 不能使用form标签,因为modelAttribute对应的bean中没有_method这个属性,只能使用input -->
<input type="hidden" name="_method" value="PUT"/>
</c:if> Email:<form:input path="email"/><br>
<%
Map<String,String> genders=new HashMap();
genders.put("1", "Male");
genders.put("0", "Female");
request.setAttribute("genders", genders);
%>
Gender:<form:radiobuttons path="gender" items="${genders}"/><br>
Department:<form:select path="department.id"
items="${department}" itemLabel="departmentName" itemValue="id"></form:select><br>
<input type="submit" values="Submit">
</form:form>
</body>
</html>

4.效果

  

  

二:

最新文章

  1. swift 学习笔记[1]
  2. Sharepoint学习笔记—习题系列--70-576习题解析 -(Q63-Q65)
  3. JavaScipt 源码解析 回调函数
  4. [原创]android使用代码生成LayerDrawable的方法和注意事项
  5. 将Excel文件.xls导入SQL Server 2005
  6. Or
  7. JS单例设计模式
  8. [iOS基础控件 - 6.12.1] QQ菜单管理 UITabBarController 控制器管理
  9. epoll和select区别
  10. jquery mobile基本结构搭建
  11. mysql命令行里的加载更多显示
  12. codeforces 540D 概率dp
  13. FasfDFS整合Java实现文件上传下载
  14. C#设计模式之一单例模式(Singleton Pattern)【创建型】
  15. 原生js实现 五子棋
  16. redisSession和mockSession
  17. Vue:window.onresize
  18. day05(数字类型,字符串类型,列表类型)
  19. mysql 通过测试&#39;for update&#39;,深入了解行锁、表锁、索引
  20. Inspector did not run successfully.

热门文章

  1. 【Linux】VMware虚拟机中如何配置静态IP
  2. Netty通信原理
  3. Linux mmc framework2:基本组件之block
  4. kindle转换工具-calibre
  5. CROSSUI桌面工具 分布加载模块(Distributed UI Module) 与 主模块Module 之间数据传输!
  6. MySQL5.7更改用户名密码
  7. DataTables 1.10.x与1.9.x参数名对照表
  8. 出现“error LNK1169: 找到一个或多个多重定义的符号”的原因
  9. R-TREE
  10. eclipse自动添加注释