From 39c15db737f9b9810ad5c9ca9e552022089e3ac3 Mon Sep 17 00:00:00 2001 From: Fireply Date: Mon, 16 May 2016 23:49:04 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=20Spring=20&=20Struts2=20&?= =?UTF-8?q?=20Hibernate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WebRoot/WEB-INF/web.xml | 49 ++++++++++++++++-- src/main/resources/applicationContext.xml | 61 +++++++++++++++++++++++ src/main/resources/config.properties | 5 ++ src/main/resources/struts.xml | 14 ++++++ 4 files changed, 125 insertions(+), 4 deletions(-) create mode 100644 src/main/resources/applicationContext.xml create mode 100644 src/main/resources/config.properties create mode 100644 src/main/resources/struts.xml diff --git a/WebRoot/WEB-INF/web.xml b/WebRoot/WEB-INF/web.xml index 0504b34..e52835c 100644 --- a/WebRoot/WEB-INF/web.xml +++ b/WebRoot/WEB-INF/web.xml @@ -1,12 +1,53 @@ Enter + + + org.springframework.web.context.ContextLoaderListener + + + + contextConfigLocation + classpath:applicationContext.xml + + + + openSessionInViewFilter + org.springframework.orm.hibernate4.support.OpenSessionInViewFilter + + sessionFactoryBeanName + sessionFactory + + + + + openSessionInViewFilter + /* + + + + struts2 + org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter + + + + struts2 + /* + + + + index.html - index.htm index.jsp - default.html - default.htm - default.jsp \ No newline at end of file diff --git a/src/main/resources/applicationContext.xml b/src/main/resources/applicationContext.xml new file mode 100644 index 0000000..23bd0a3 --- /dev/null +++ b/src/main/resources/applicationContext.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + com.mysql.jdbc.Driver + + + jdbc:mysql://localhost/enter + + + root + + + passwordword + + + + + + + + + + ${hibernate.dialect} + ${hibernate.show_sql} + ${hibernate.format_sql} + true + ${hibernate.hbm2ddl.auto} + enter + org.springframework.orm.hibernate4.SpringSessionContext + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/config.properties b/src/main/resources/config.properties new file mode 100644 index 0000000..c551f7d --- /dev/null +++ b/src/main/resources/config.properties @@ -0,0 +1,5 @@ +hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect +hibernate.show_sql = true +hibernate.format_sql = true +#hibernate.use_sql_comments = true +hibernate.hbm2ddl.auto = update diff --git a/src/main/resources/struts.xml b/src/main/resources/struts.xml new file mode 100644 index 0000000..59c622a --- /dev/null +++ b/src/main/resources/struts.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + error/error.jsp + + + \ No newline at end of file