diff --git a/ssh_1904_mengchengc/pom.xml b/ssh_1904_mengchengc/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..e6b054c03e0e3b3804193418961e18f2c4189ff9 --- /dev/null +++ b/ssh_1904_mengchengc/pom.xml @@ -0,0 +1,160 @@ + + + + + javaee19-1 + org.example + 1.0-SNAPSHOT + + 4.0.0 + + ssh_demo + war + + ssh_demo Maven Webapp + + http://www.example.com + + + + UTF-8 + + 2.5.10 + 4.3.8.RELEASE + 4.2.4.Final + + + + + junit + junit + 3.8.1 + test + + + + + org.springframework + spring-core + ${spring.version} + + + + org.springframework + spring-web + ${spring.version} + + + + org.springframework + spring-orm + ${spring.version} + + + + org.apache.struts + struts2-core + ${struts.version} + + + + org.apache.struts + struts2-spring-plugin + ${struts.version} + + + + org.hibernate + hibernate-core + ${hibernate.version} + + + + mysql + mysql-connector-java + 5.1.42 + + + + com.mchange + c3p0 + 0.9.5 + + + + org.aspectj + aspectjweaver + 1.8.10 + + + + org.slf4j + slf4j-log4j12 + 1.7.25 + + + + commons-dbcp + commons-dbcp + 1.4 + + + commons-pool + commons-pool + 1.6 + + + org.apache.taglibs + taglibs-standard-spec + 1.2.5 + + + org.apache.taglibs + taglibs-standard-impl + 1.2.5 + + + org.apache.struts + struts2-json-plugin + 2.3.16 + + + + + ssh_demo + + + + maven-clean-plugin + 3.1.0 + + + + maven-resources-plugin + 3.0.2 + + + maven-compiler-plugin + 3.8.0 + + + maven-surefire-plugin + 2.22.1 + + + maven-war-plugin + 3.2.2 + + + maven-install-plugin + 2.5.2 + + + maven-deploy-plugin + 2.8.2 + + + + + diff --git a/ssh_1904_mengchengc/src/main/java/mengchengc/controller/MengChengcController.java b/ssh_1904_mengchengc/src/main/java/mengchengc/controller/MengChengcController.java new file mode 100644 index 0000000000000000000000000000000000000000..bfac9fdf99eb37d87997f88be30894d9b1146a3a --- /dev/null +++ b/ssh_1904_mengchengc/src/main/java/mengchengc/controller/MengChengcController.java @@ -0,0 +1,70 @@ +package mengchengc.controller; + +import mengchengc.entity.MengChengcEntity; +import mengchengc.service.MengChengcService; + +import javax.annotation.Resource; +import java.util.List; + +public class MengChengcController { + List list = null; + MengChengcEntity mengchengcEntity=null; + String name = null; + String flag = "0"; + @Resource + MengChengcService mengchengcservice; + + public String queryPage(){ + list =mengchengcservice.queryPage(name); + return "queryPage"; + } + + public String save(){ + mengchengcservice.save(mengchengcEntity); + flag = "1"; + return "save"; + } + //@Resource @Autowired 作用相同 去spring容器中到bean实例 + //@Service @Component 向spring 容器中放入bean(类的对象)实例 + + + public List getList() { + return list; + } + + public MengChengcEntity getMengChengcEntity() { + return mengchengcEntity; + } + + public void setMengChengcEntity(MengChengcEntity mengchengcEntity) { + this.mengchengcEntity = mengchengcEntity; + } + + public MengChengcService getMengChengcservice() { + return mengchengcservice; + } + + public void setMengChengcservice(MengChengcService mengchengcservice) { + this.mengchengcservice = mengchengcservice; + } + + public String getFlag() { + return flag; + } + + public void setFlag(String flag) { + this.flag = flag; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public void setList(List list) { + this.list = list; + } +} diff --git a/ssh_1904_mengchengc/src/main/java/mengchengc/dao/MengChengcDao.java b/ssh_1904_mengchengc/src/main/java/mengchengc/dao/MengChengcDao.java new file mode 100644 index 0000000000000000000000000000000000000000..853d6d4d37fd6c5d0b6c1eb65bd8b7f38b2ff8f8 --- /dev/null +++ b/ssh_1904_mengchengc/src/main/java/mengchengc/dao/MengChengcDao.java @@ -0,0 +1,35 @@ +package mengchengc.dao; + +import mengchengc.entity.MengChengcEntity; +import org.hibernate.Query; +import org.hibernate.transform.Transformers; +import org.springframework.orm.hibernate4.support.HibernateDaoSupport; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Component() +public class MengChengcDao extends HibernateDaoSupport { + + + + + + public List queryPage(String name) { + + String sql = "select * from j04mengchengc where name like ? "; + Query query=getSessionFactory().openSession().createSQLQuery(sql); + query.setParameter(0, "%" + name + "%"); + //将查询结果转成Map对象的集合 + // query.setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP); + query.setResultTransformer(Transformers.aliasToBean(MengChengcEntity.class)); + List list= query.list(); + + return list; + } + @Transactional + public void save(MengChengcEntity mengchengcEntity) { + getSessionFactory().openSession().saveOrUpdate(mengchengcEntity); + } +} diff --git a/ssh_demo/src/main/java/zhangcong/entity/ZhangCongEntity.java b/ssh_1904_mengchengc/src/main/java/mengchengc/entity/MengChengcEntity.java similarity index 92% rename from ssh_demo/src/main/java/zhangcong/entity/ZhangCongEntity.java rename to ssh_1904_mengchengc/src/main/java/mengchengc/entity/MengChengcEntity.java index f72bfb882b6ce1490dfda6ae7c95bc07e369ad82..2ef0b213477e107bfafc2c50acea42d16c9458c6 100644 --- a/ssh_demo/src/main/java/zhangcong/entity/ZhangCongEntity.java +++ b/ssh_1904_mengchengc/src/main/java/mengchengc/entity/MengChengcEntity.java @@ -1,6 +1,6 @@ -package zhangcong.entity; +package mengchengc.entity; -public class ZhangCongEntity { +public class MengChengcEntity { private Integer id; private String name; @@ -11,6 +11,10 @@ public class ZhangCongEntity { return id; } + public void setId(Integer id) { + this.id = id; + } + public Integer getBid() { return bid; } @@ -35,10 +39,6 @@ public class ZhangCongEntity { this.bname = bname; } - public void setId(Integer id) { - this.id = id; - } - public String getName() { return name; } diff --git a/ssh_1904_mengchengc/src/main/java/mengchengc/service/MengChengcService.java b/ssh_1904_mengchengc/src/main/java/mengchengc/service/MengChengcService.java new file mode 100644 index 0000000000000000000000000000000000000000..f8498437c6bf4cf7a965f4c2fd53e50b0d429ca9 --- /dev/null +++ b/ssh_1904_mengchengc/src/main/java/mengchengc/service/MengChengcService.java @@ -0,0 +1,13 @@ +package mengchengc.service; + +import mengchengc.entity.MengChengcEntity; + +import java.util.List; + +public interface MengChengcService { + + + List queryPage(String name); + + void save(MengChengcEntity mengchengcEntity); +} diff --git a/ssh_1904_mengchengc/src/main/java/mengchengc/service/impl/MengChengcServiceImpl.java b/ssh_1904_mengchengc/src/main/java/mengchengc/service/impl/MengChengcServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..06bff927370f364c05cb76c7a1c52fe2fc75ed2b --- /dev/null +++ b/ssh_1904_mengchengc/src/main/java/mengchengc/service/impl/MengChengcServiceImpl.java @@ -0,0 +1,27 @@ +package mengchengc.service.impl; + +import mengchengc.dao.MengChengcDao; +import mengchengc.entity.MengChengcEntity; +import mengchengc.service.MengChengcService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +@Service("mengchengcservice") +public class MengChengcServiceImpl implements MengChengcService { + @Autowired + MengChengcDao mengchengcDao; + + + @Override + public List queryPage(String name) { + return mengchengcDao.queryPage(name); + } + + @Override + public void save(MengChengcEntity mengchengcEntity) { + mengchengcDao.save(mengchengcEntity); + } +} diff --git a/ssh_demo/src/main/resources/applicationcontext.xml b/ssh_1904_mengchengc/src/main/resources/applicationcontext.xml similarity index 100% rename from ssh_demo/src/main/resources/applicationcontext.xml rename to ssh_1904_mengchengc/src/main/resources/applicationcontext.xml diff --git a/ssh_demo/src/main/resources/conf/hrb/ZhangCong.hbm.xml b/ssh_1904_mengchengc/src/main/resources/conf/hrb/MengChengc.hbm.xml similarity index 86% rename from ssh_demo/src/main/resources/conf/hrb/ZhangCong.hbm.xml rename to ssh_1904_mengchengc/src/main/resources/conf/hrb/MengChengc.hbm.xml index 8d191a8e8d65144dc057f1a16679346bcd0df707..8d4ad65d3be55bf013f611c8c65f516089571b5f 100644 --- a/ssh_demo/src/main/resources/conf/hrb/ZhangCong.hbm.xml +++ b/ssh_1904_mengchengc/src/main/resources/conf/hrb/MengChengc.hbm.xml @@ -3,7 +3,7 @@ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> - + diff --git a/ssh_demo/src/main/resources/conf/struts/zhangcongstrust.xml b/ssh_1904_mengchengc/src/main/resources/conf/struts/mengchengcstrust.xml similarity index 81% rename from ssh_demo/src/main/resources/conf/struts/zhangcongstrust.xml rename to ssh_1904_mengchengc/src/main/resources/conf/struts/mengchengcstrust.xml index 2d5cbb8552cc23556659ae266c569e040315473a..6577a8030d137faa468ecfb258f588db7995f69f 100644 --- a/ssh_demo/src/main/resources/conf/struts/zhangcongstrust.xml +++ b/ssh_1904_mengchengc/src/main/resources/conf/struts/mengchengcstrust.xml @@ -4,8 +4,8 @@ "http://struts.apache.org/dtds/struts-2.5.dtd"> - - + + page diff --git a/ssh_1904_mengchengc/src/main/resources/database.properties b/ssh_1904_mengchengc/src/main/resources/database.properties new file mode 100644 index 0000000000000000000000000000000000000000..9a3da9d7c70d9839c37a4950de5a276b3f93a614 --- /dev/null +++ b/ssh_1904_mengchengc/src/main/resources/database.properties @@ -0,0 +1,15 @@ +driver=com.mysql.jdbc.Driver +<<<<<<< Updated upstream:ssh_demo/src/main/resources/database.properties +url=jdbc:mysql://localhost:3306/java3456?useUnicode=true&characterEncoding=utf-8 +======= +url=jdbc:mysql://127.0.0.1:3306/java3456?useUnicode=true&characterEncoding=utf-8 +>>>>>>> Stashed changes:ssh_1904_mengchengc/src/main/resources/database.properties +user=root +password=x5 +minIdle=45 +maxIdle=50 +initialSize=5 +maxActive=100 +maxWait=100 +removeAbandonedTimeout=180 +removeAbandoned=true diff --git a/ssh_1904_mengchengc/src/main/resources/struts.xml b/ssh_1904_mengchengc/src/main/resources/struts.xml new file mode 100644 index 0000000000000000000000000000000000000000..840db372af6dc0df571b256b8ab771494c662797 --- /dev/null +++ b/ssh_1904_mengchengc/src/main/resources/struts.xml @@ -0,0 +1,20 @@ + + + + + + + + list + + + flag + + + queryPage,save + + + + \ No newline at end of file diff --git a/ssh_demo/src/main/webapp/WEB-INF/web.xml b/ssh_1904_mengchengc/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from ssh_demo/src/main/webapp/WEB-INF/web.xml rename to ssh_1904_mengchengc/src/main/webapp/WEB-INF/web.xml diff --git a/ssh_demo/src/main/webapp/index.jsp b/ssh_1904_mengchengc/src/main/webapp/index.jsp similarity index 100% rename from ssh_demo/src/main/webapp/index.jsp rename to ssh_1904_mengchengc/src/main/webapp/index.jsp diff --git a/ssh_demo/src/main/webapp/zhangc/dept_index.html b/ssh_1904_mengchengc/src/main/webapp/mengchengc/dept_index.html similarity index 100% rename from ssh_demo/src/main/webapp/zhangc/dept_index.html rename to ssh_1904_mengchengc/src/main/webapp/mengchengc/dept_index.html diff --git a/ssh_demo/src/main/webapp/zhangc/zc.html b/ssh_1904_mengchengc/src/main/webapp/mengchengc/mcc.html similarity index 82% rename from ssh_demo/src/main/webapp/zhangc/zc.html rename to ssh_1904_mengchengc/src/main/webapp/mengchengc/mcc.html index 8d163a9c6f09a279fa43f0e56ec699df11df9688..9d572bf1f483b1b297897c9f7524717f4c558168 100644 --- a/ssh_demo/src/main/webapp/zhangc/zc.html +++ b/ssh_1904_mengchengc/src/main/webapp/mengchengc/mcc.html @@ -5,6 +5,6 @@ Title -hello zhangkun1234 +hello mengchengcheng1234 \ No newline at end of file diff --git a/ssh_demo/src/main/webapp/zhangc/static/favicon.ico b/ssh_1904_mengchengc/src/main/webapp/mengchengc/static/favicon.ico similarity index 100% rename from ssh_demo/src/main/webapp/zhangc/static/favicon.ico rename to ssh_1904_mengchengc/src/main/webapp/mengchengc/static/favicon.ico diff --git a/ssh_demo/src/main/webapp/zhangc/user_create.html b/ssh_1904_mengchengc/src/main/webapp/mengchengc/user_create.html similarity index 90% rename from ssh_demo/src/main/webapp/zhangc/user_create.html rename to ssh_1904_mengchengc/src/main/webapp/mengchengc/user_create.html index 8a43f39ef9b1f013632a502d684dbc4d993662fe..c7c22aa40a2118975ecbdb82027f1de99e665b35 100644 --- a/ssh_demo/src/main/webapp/zhangc/user_create.html +++ b/ssh_1904_mengchengc/src/main/webapp/mengchengc/user_create.html @@ -83,19 +83,27 @@
- +
+<<<<<<< Updated upstream:ssh_demo/src/main/webapp/zhangc/user_create.html +======= + +>>>>>>> Stashed changes:ssh_1904_mengchengc/src/main/webapp/mengchengc/user_create.html
+<<<<<<< Updated upstream:ssh_demo/src/main/webapp/zhangc/user_create.html +>>>>>>> Stashed changes:ssh_1904_mengchengc/src/main/webapp/mengchengc/user_create.html @@ -179,7 +187,7 @@ function sub() { $.ajax({ type:"post", - url:baseUrl+"/zhangcong!save", + url:baseUrl+"/mengchengc!save", data:$("#form").serialize(),//{'name':name,‘age’:age} success:function () { window.location.href="user_index.html"; diff --git a/ssh_demo/src/main/webapp/zhangc/user_index.html b/ssh_1904_mengchengc/src/main/webapp/mengchengc/user_index.html similarity index 98% rename from ssh_demo/src/main/webapp/zhangc/user_index.html rename to ssh_1904_mengchengc/src/main/webapp/mengchengc/user_index.html index be8b2fdc23e88c363537342afac0ef954f084178..4bc297199696db4d953b6bf910fa913e421dd561 100644 --- a/ssh_demo/src/main/webapp/zhangc/user_index.html +++ b/ssh_1904_mengchengc/src/main/webapp/mengchengc/user_index.html @@ -149,7 +149,7 @@ var name = $("#name").val();//获取姓名文本框 $.ajax({ type:"post", - url:baseUrl+"/zhangcong!queryPage",//controller --->404 + url:baseUrl+"/mengchengc!queryPage",//controller --->404 data:{"name":name,"pageNo":a}, dataType:"json", success:function (res) {