diff --git a/src/com/ssm/controller/EquipController.java b/src/com/ssm/controller/EquipController.java new file mode 100644 index 0000000..909735c --- /dev/null +++ b/src/com/ssm/controller/EquipController.java @@ -0,0 +1,18 @@ +package com.ssm.controller; + +import com.ssm.entity.Equip; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +@RequestMapping("equipment") +public class EquipController { + + //对象方式接收设备信息 + @RequestMapping("add") + public String test(Equip equipment){ + System.out.println("设备信息:"+equipment.toString()); + return "showEquipment"; + } + +} diff --git a/src/com/ssm/controller/FirstController.java b/src/com/ssm/controller/FirstController.java new file mode 100644 index 0000000..c08cd7e --- /dev/null +++ b/src/com/ssm/controller/FirstController.java @@ -0,0 +1,13 @@ +package com.ssm.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +public class FirstController { + @RequestMapping("hello") + public String hello() { + System.out.println("1111"); + return "showFirst"; + } +} diff --git a/src/com/ssm/controller/LabxController.java b/src/com/ssm/controller/LabxController.java new file mode 100644 index 0000000..63ff9a0 --- /dev/null +++ b/src/com/ssm/controller/LabxController.java @@ -0,0 +1,22 @@ +package com.ssm.controller; + +import com.ssm.entity.Labx; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; + +@Controller +@RequestMapping("laboratory") +public class LabxController { + + //对象方式接收数据,ModelAndView对象响应数据 + @RequestMapping("add") + public ModelAndView test(Labx laboratory){ + //创建ModelAndView对象的同时设置了view的信息 + ModelAndView mv=new ModelAndView("showLaboratory"); + //将这个对象laboratory保存到ModelAndView对象中 + mv.addObject("laboratoryInfo", laboratory); + return mv; + } + +} diff --git a/src/com/ssm/entity/Cate.java b/src/com/ssm/entity/Cate.java new file mode 100644 index 0000000..c70dc5d --- /dev/null +++ b/src/com/ssm/entity/Cate.java @@ -0,0 +1,46 @@ +package com.ssm.entity; + +// 设备类型表的实体类 +public class Cate { + private String cateid; // 设备类型id + private String catename; // 类型名称 + private String addtime; // 创建日期 + private String memo; // 备注 + + public String getCateid() { + return cateid; + } + + public void setCateid(String cateid) { + this.cateid = cateid; + } + + public String getCatename() { + return catename; + } + + public void setCatename(String catename) { + this.catename = catename; + } + + public String getAddtime() { + return addtime; + } + + public void setAddtime(String addtime) { + this.addtime = addtime; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + public void printMessage(){ + System.out.println("this is Category"); + } + +} diff --git a/src/com/ssm/entity/Equip.java b/src/com/ssm/entity/Equip.java new file mode 100644 index 0000000..78bfa61 --- /dev/null +++ b/src/com/ssm/entity/Equip.java @@ -0,0 +1,128 @@ +package com.ssm.entity; + +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +// 设备表的实体类 +public class Equip { + private String equipid; // 设备id + private String eno; // 设备号 + private String equipname; // 设备名称 + private String useinfo; // 设备作用 + private String productor; // 生产厂商 + private String price; // 采购金额 + @DateTimeFormat(pattern = "yyyy-mm-dd") + private Date buydate; // 采购日期 + private String manager; // 负责人 + private String memo; // 备注 + private Cate cate;// 多对一映射类 + private Labx labx;// 多对一映射类 + + public String getEquipid() { + return equipid; + } + + public void setEquipid(String equipid) { + this.equipid = equipid; + } + + public String getEno() { + return eno; + } + + public void setEno(String eno) { + this.eno = eno; + } + + public String getEquipname() { + return equipname; + } + + public void setEquipname(String equipname) { + this.equipname = equipname; + } + + public String getUseinfo() { + return useinfo; + } + + public void setUseinfo(String useinfo) { + this.useinfo = useinfo; + } + + public String getProductor() { + return productor; + } + + public void setProductor(String productor) { + this.productor = productor; + } + + public String getPrice() { + return price; + } + + public void setPrice(String price) { + this.price = price; + } + + public Date getBuydate() { + return buydate; + } + + public void setBuydate(Date buydate) { + this.buydate = buydate; + } + + public String getManager() { + return manager; + } + + public void setManager(String manager) { + this.manager = manager; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + public Cate getCate() { + return cate; + } + + public void setCate(Cate cate) { + this.cate = cate; + } + + public Labx getLabx() { + return labx; + } + + public void setLabx(Labx labx) { + this.labx = labx; + } + + @Override + public String toString() { + return "Equipment{" + + "equipid=" + equipid + + ", equipname='" + equipname + '\'' + + ", eno=" + eno + + ", productor=" + productor + + ", price='" + price + '\'' + + ", buydate='" + buydate + '\'' + + ", manager=" + manager + + ", useinfo=" + useinfo + + // 输出设备分类名称 + ", categoryName=" + cate.getCatename() + + // 输出设备所在实验室名称 + ", categoryName=" + labx.getLabxname() + + '}'; + } + +} diff --git a/src/com/ssm/entity/Labx.java b/src/com/ssm/entity/Labx.java new file mode 100644 index 0000000..895371f --- /dev/null +++ b/src/com/ssm/entity/Labx.java @@ -0,0 +1,83 @@ +package com.ssm.entity; + +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +// 实验室表的实体类 +public class Labx { + private String labxid; // 实验室id + private String labxname; // 实验室名称 + private String manager; // 负责人 + private String contact; // 联系方式 + private String address; // 实验室地址 + @DateTimeFormat(pattern = "yyyy-mm-dd") + private Date addtime; // 创建日期 + private String memo; // 备注 + + + + public String getLabxid() { + return labxid; + } + + public void setLabxid(String labxid) { + this.labxid = labxid; + } + + public String getLabxname() { + return labxname; + } + + public void setLabxname(String labxname) { + this.labxname = labxname; + } + + public String getManager() { + return manager; + } + + public void setManager(String manager) { + this.manager = manager; + } + + public String getContact() { + return contact; + } + + public void setContact(String contact) { + this.contact = contact; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public Date getAddtime() { + return addtime; + } + + public void setAddtime(Date addtime) { + this.addtime = addtime; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + public void printMessage(){ + System.out.println("this is Laboratory"); + } +} + + + + diff --git a/src/springmvc.xml b/src/springmvc.xml new file mode 100644 index 0000000..a202e8b --- /dev/null +++ b/src/springmvc.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + diff --git a/web/WEB-INF/lib/commons-logging-1.2.jar b/web/WEB-INF/lib/commons-logging-1.2.jar new file mode 100644 index 0000000..93a3b9f Binary files /dev/null and b/web/WEB-INF/lib/commons-logging-1.2.jar differ diff --git a/web/WEB-INF/lib/jsp-api.jar b/web/WEB-INF/lib/jsp-api.jar new file mode 100644 index 0000000..d405b74 Binary files /dev/null and b/web/WEB-INF/lib/jsp-api.jar differ diff --git a/web/WEB-INF/lib/servlet-api.jar b/web/WEB-INF/lib/servlet-api.jar new file mode 100644 index 0000000..209d963 Binary files /dev/null and b/web/WEB-INF/lib/servlet-api.jar differ diff --git a/web/WEB-INF/lib/spring-aop-5.3.9.jar b/web/WEB-INF/lib/spring-aop-5.3.9.jar new file mode 100644 index 0000000..0228616 Binary files /dev/null and b/web/WEB-INF/lib/spring-aop-5.3.9.jar differ diff --git a/web/WEB-INF/lib/spring-beans-5.3.9.jar b/web/WEB-INF/lib/spring-beans-5.3.9.jar new file mode 100644 index 0000000..b250ccc Binary files /dev/null and b/web/WEB-INF/lib/spring-beans-5.3.9.jar differ diff --git a/web/WEB-INF/lib/spring-context-5.3.9.jar b/web/WEB-INF/lib/spring-context-5.3.9.jar new file mode 100644 index 0000000..48e3715 Binary files /dev/null and b/web/WEB-INF/lib/spring-context-5.3.9.jar differ diff --git a/web/WEB-INF/lib/spring-core-5.3.9.jar b/web/WEB-INF/lib/spring-core-5.3.9.jar new file mode 100644 index 0000000..e51f071 Binary files /dev/null and b/web/WEB-INF/lib/spring-core-5.3.9.jar differ diff --git a/web/WEB-INF/lib/spring-expression-5.3.9.jar b/web/WEB-INF/lib/spring-expression-5.3.9.jar new file mode 100644 index 0000000..42fcd3f Binary files /dev/null and b/web/WEB-INF/lib/spring-expression-5.3.9.jar differ diff --git a/web/WEB-INF/lib/spring-web-5.3.9.jar b/web/WEB-INF/lib/spring-web-5.3.9.jar new file mode 100644 index 0000000..d575c2b Binary files /dev/null and b/web/WEB-INF/lib/spring-web-5.3.9.jar differ diff --git a/web/WEB-INF/lib/spring-webmvc-5.3.9.jar b/web/WEB-INF/lib/spring-webmvc-5.3.9.jar new file mode 100644 index 0000000..168a85c Binary files /dev/null and b/web/WEB-INF/lib/spring-webmvc-5.3.9.jar differ diff --git a/web/WEB-INF/view/showEquipment.jsp b/web/WEB-INF/view/showEquipment.jsp new file mode 100644 index 0000000..a084f7d --- /dev/null +++ b/web/WEB-INF/view/showEquipment.jsp @@ -0,0 +1,15 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + + +展示Controller接收及响应数据 + + +Success! +
+设备信息已在控制台输出! + + + \ No newline at end of file diff --git a/web/WEB-INF/view/showFirst.jsp b/web/WEB-INF/view/showFirst.jsp new file mode 100644 index 0000000..3c42d25 --- /dev/null +++ b/web/WEB-INF/view/showFirst.jsp @@ -0,0 +1,12 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + + +展示入门程序信息 + + +Success! + + \ No newline at end of file diff --git a/web/WEB-INF/view/showLaboratory.jsp b/web/WEB-INF/view/showLaboratory.jsp new file mode 100644 index 0000000..40ffdcd --- /dev/null +++ b/web/WEB-INF/view/showLaboratory.jsp @@ -0,0 +1,22 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + + +展示实验室信息 + + +Success! +
+实验室编号:${laboratoryInfo.labxid} +
+实验室名称:${laboratoryInfo.labxname} +
+负责人:${laboratoryInfo.manager} +
+联系方式:${laboratoryInfo.contact} +
+地址:${laboratoryInfo.address} + + \ No newline at end of file diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml new file mode 100644 index 0000000..313ae7c --- /dev/null +++ b/web/WEB-INF/web.xml @@ -0,0 +1,43 @@ + + + SpringMVCFirst + + index.html + index.htm + index.jsp + default.html + default.htm + default.jsp + + + springDispatcherServlet + org.springframework.web.servlet.DispatcherServlet + + + contextConfigLocation + + classpath:springmvc.xml + + + 1 + + + springDispatcherServlet + + / + + + + characterEncodingFilter + org.springframework.web.filter.CharacterEncodingFilter + + encoding + UTF-8 + + + + characterEncodingFilter + /* + + + \ No newline at end of file diff --git a/web/addEquipment.jsp b/web/addEquipment.jsp new file mode 100644 index 0000000..efbfa55 --- /dev/null +++ b/web/addEquipment.jsp @@ -0,0 +1,67 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + + +添加设备 + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
设备号:
设备名称:
设备分类:
所属实验室:
设备作用:
生产厂商:
采购金额:
采购日期:
负责人:
+ +
+
+ + \ No newline at end of file diff --git a/web/addLaboratory.jsp b/web/addLaboratory.jsp new file mode 100644 index 0000000..9e336cc --- /dev/null +++ b/web/addLaboratory.jsp @@ -0,0 +1,25 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + + +添加实验室信息 + + +
+ 实验室编号: +
+ 实验室名称: +
+ 负责人: +
+ 联系方式: +
+ 地址: +
+ +
+ + + \ No newline at end of file diff --git a/web/first.jsp b/web/first.jsp new file mode 100644 index 0000000..b5ff431 --- /dev/null +++ b/web/first.jsp @@ -0,0 +1,12 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + + +入门程序 + + +hello world + + \ No newline at end of file