diff --git a/.idea/artifacts/HibernateDamo_war_exploded.xml b/.idea/artifacts/HibernateDamo_war_exploded.xml
new file mode 100644
index 0000000..73e91a1
--- /dev/null
+++ b/.idea/artifacts/HibernateDamo_war_exploded.xml
@@ -0,0 +1,13 @@
+
+
+ $PROJECT_DIR$/out/artifacts/HibernateDamo_war_exploded
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..38d573b
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/dataSources.local.xml b/.idea/dataSources.local.xml
new file mode 100644
index 0000000..bd41cf1
--- /dev/null
+++ b/.idea/dataSources.local.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+ #@
+ `
+
+
+ master_key
+ root
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml
new file mode 100644
index 0000000..4f378be
--- /dev/null
+++ b/.idea/dataSources.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ mysql.8
+ true
+ com.mysql.cj.jdbc.Driver
+ jdbc:mysql://localhost:3306/xianshu
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/dataSources/f04c8927-a966-444e-85ca-60ef5b013a3e.xml b/.idea/dataSources/f04c8927-a966-444e-85ca-60ef5b013a3e.xml
new file mode 100644
index 0000000..1c6e8a2
--- /dev/null
+++ b/.idea/dataSources/f04c8927-a966-444e-85ca-60ef5b013a3e.xml
@@ -0,0 +1,1261 @@
+
+
+
+
+ 8.0.16
+ InnoDB
+ InnoDB
+ lower/lower
+
+
+ utf8mb4_0900_ai_ci
+
+
+ utf8_general_ci
+
+
+ utf8mb4_0900_ai_ci
+
+
+ utf8mb4_0900_ai_ci
+
+
+ utf8mb4_0900_ai_ci
+
+
+ utf8mb4_0900_ai_ci
+
+
+ utf8mb4_0900_ai_ci
+
+
+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
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+
+
+
+
+ 1
+ int(10) unsigned|0s
+ 1
+ 1
+ normal
+
+
+ 2
+ varchar(45)|0s
+ normal
+
+
+ 3
+ int(11)|0s
+ normal
+
+
+ 4
+ varchar(45)|0s
+ normal
+
+
+ 5
+ varchar(45)|0s
+ normal
+
+
+ 6
+ int(11)|0s
+ normal
+
+
+ bookid
+ 1
+ btree
+
+
+ 1
+ bookid
+ 1
+
+
+ bookid
+ bookid_UNIQUE
+
+
+ 1
+ int(11)|0s
+ 1
+ 1
+ normal
+
+
+ 2
+ int(11)|0s
+ normal
+
+
+ 3
+ int(11)|0s
+ normal
+
+
+ 4
+ int(11)|0s
+ normal
+
+
+ orderId
+ 1
+ btree
+
+
+ 1
+ orderId
+ 1
+
+
+ orderId
+ orderId_UNIQUE
+
+
+ 1
+ int(11)|0s
+ 1
+ normal
+
+
+ 2
+ int(11)|0s
+ normal
+
+
+ 3
+ int(11)|0s
+ normal
+
+
+ 1
+ cartID
+ 1
+
+
+ 1
+ int(11)|0s
+ 1
+ normal
+
+
+ 2
+ varchar(45)|0s
+ normal
+
+
+ 3
+ varchar(45)|0s
+ normal
+
+
+ 4
+ varchar(45)|0s
+ normal
+
+
+ 5
+ varchar(45)|0s
+ normal
+
+
+ 1
+ userID
+ 1
+
+
+
\ No newline at end of file
diff --git a/.idea/dataSources/f04c8927-a966-444e-85ca-60ef5b013a3e/storage_v2/_src_/schema/information_schema.FNRwLQ.meta b/.idea/dataSources/f04c8927-a966-444e-85ca-60ef5b013a3e/storage_v2/_src_/schema/information_schema.FNRwLQ.meta
new file mode 100644
index 0000000..1ff3db2
--- /dev/null
+++ b/.idea/dataSources/f04c8927-a966-444e-85ca-60ef5b013a3e/storage_v2/_src_/schema/information_schema.FNRwLQ.meta
@@ -0,0 +1,2 @@
+#n:information_schema
+! [null, 0, null, null, -2147483648, -2147483648]
diff --git a/.idea/libraries/Hibernate_5_4_9_5_4_9.xml b/.idea/libraries/Hibernate_5_4_9_5_4_9.xml
new file mode 100644
index 0000000..30f2e26
--- /dev/null
+++ b/.idea/libraries/Hibernate_5_4_9_5_4_9.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Java_EE_6_Java_EE_6.xml b/.idea/libraries/Java_EE_6_Java_EE_6.xml
new file mode 100644
index 0000000..c499ecf
--- /dev/null
+++ b/.idea/libraries/Java_EE_6_Java_EE_6.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml
new file mode 100644
index 0000000..fa8838a
--- /dev/null
+++ b/.idea/libraries/lib.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/lib__2_.xml b/.idea/libraries/lib__2_.xml
new file mode 100644
index 0000000..0ae6450
--- /dev/null
+++ b/.idea/libraries/lib__2_.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..0548357
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..d1c5c0b
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..e96534f
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..0eb9d5c
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..491a511
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,260 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1577946059823
+
+
+ 1577946059823
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HibernateDamo.iml b/HibernateDamo.iml
new file mode 100644
index 0000000..d529165
--- /dev/null
+++ b/HibernateDamo.iml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/FastInfoset-1.2.15.jar b/lib/FastInfoset-1.2.15.jar
new file mode 100644
index 0000000..2671209
Binary files /dev/null and b/lib/FastInfoset-1.2.15.jar differ
diff --git a/lib/antlr-2.7.7.jar b/lib/antlr-2.7.7.jar
new file mode 100644
index 0000000..5e5f14b
Binary files /dev/null and b/lib/antlr-2.7.7.jar differ
diff --git a/lib/byte-buddy-1.10.2.jar b/lib/byte-buddy-1.10.2.jar
new file mode 100644
index 0000000..b04187b
Binary files /dev/null and b/lib/byte-buddy-1.10.2.jar differ
diff --git a/lib/classmate-1.5.1.jar b/lib/classmate-1.5.1.jar
new file mode 100644
index 0000000..819f5ea
Binary files /dev/null and b/lib/classmate-1.5.1.jar differ
diff --git a/lib/dom4j-2.1.1.jar b/lib/dom4j-2.1.1.jar
new file mode 100644
index 0000000..cda47db
Binary files /dev/null and b/lib/dom4j-2.1.1.jar differ
diff --git a/lib/hibernate-commons-annotations-5.1.0.Final.jar b/lib/hibernate-commons-annotations-5.1.0.Final.jar
new file mode 100644
index 0000000..9a9d5b7
Binary files /dev/null and b/lib/hibernate-commons-annotations-5.1.0.Final.jar differ
diff --git a/lib/hibernate-core-5.4.9.Final.jar b/lib/hibernate-core-5.4.9.Final.jar
new file mode 100644
index 0000000..91a2062
Binary files /dev/null and b/lib/hibernate-core-5.4.9.Final.jar differ
diff --git a/lib/istack-commons-runtime-3.0.7.jar b/lib/istack-commons-runtime-3.0.7.jar
new file mode 100644
index 0000000..2fe5b82
Binary files /dev/null and b/lib/istack-commons-runtime-3.0.7.jar differ
diff --git a/lib/jandex-2.1.1.Final.jar b/lib/jandex-2.1.1.Final.jar
new file mode 100644
index 0000000..4162ece
Binary files /dev/null and b/lib/jandex-2.1.1.Final.jar differ
diff --git a/lib/javassist-3.24.0-GA.jar b/lib/javassist-3.24.0-GA.jar
new file mode 100644
index 0000000..977a081
Binary files /dev/null and b/lib/javassist-3.24.0-GA.jar differ
diff --git a/lib/javax.activation-api-1.2.0.jar b/lib/javax.activation-api-1.2.0.jar
new file mode 100644
index 0000000..986c365
Binary files /dev/null and b/lib/javax.activation-api-1.2.0.jar differ
diff --git a/lib/javax.annotation.jar b/lib/javax.annotation.jar
new file mode 100644
index 0000000..52dca7f
Binary files /dev/null and b/lib/javax.annotation.jar differ
diff --git a/lib/javax.ejb.jar b/lib/javax.ejb.jar
new file mode 100644
index 0000000..4ebf5ec
Binary files /dev/null and b/lib/javax.ejb.jar differ
diff --git a/lib/javax.jms.jar b/lib/javax.jms.jar
new file mode 100644
index 0000000..d31451a
Binary files /dev/null and b/lib/javax.jms.jar differ
diff --git a/lib/javax.persistence-api-2.2.jar b/lib/javax.persistence-api-2.2.jar
new file mode 100644
index 0000000..164ef3a
Binary files /dev/null and b/lib/javax.persistence-api-2.2.jar differ
diff --git a/lib/javax.resource.jar b/lib/javax.resource.jar
new file mode 100644
index 0000000..696a234
Binary files /dev/null and b/lib/javax.resource.jar differ
diff --git a/lib/javax.servlet.jar b/lib/javax.servlet.jar
new file mode 100644
index 0000000..0519e4a
Binary files /dev/null and b/lib/javax.servlet.jar differ
diff --git a/lib/javax.servlet.jsp.jar b/lib/javax.servlet.jsp.jar
new file mode 100644
index 0000000..9c0631c
Binary files /dev/null and b/lib/javax.servlet.jsp.jar differ
diff --git a/lib/javax.servlet.jsp.jstl.jar b/lib/javax.servlet.jsp.jstl.jar
new file mode 100644
index 0000000..7be17cc
Binary files /dev/null and b/lib/javax.servlet.jsp.jstl.jar differ
diff --git a/lib/jaxb-api-2.3.1.jar b/lib/jaxb-api-2.3.1.jar
new file mode 100644
index 0000000..4565865
Binary files /dev/null and b/lib/jaxb-api-2.3.1.jar differ
diff --git a/lib/jaxb-runtime-2.3.1.jar b/lib/jaxb-runtime-2.3.1.jar
new file mode 100644
index 0000000..0b9ef67
Binary files /dev/null and b/lib/jaxb-runtime-2.3.1.jar differ
diff --git a/lib/jboss-logging-3.3.2.Final.jar b/lib/jboss-logging-3.3.2.Final.jar
new file mode 100644
index 0000000..67cde71
Binary files /dev/null and b/lib/jboss-logging-3.3.2.Final.jar differ
diff --git a/lib/jboss-transaction-api_1.2_spec-1.1.1.Final.jar b/lib/jboss-transaction-api_1.2_spec-1.1.1.Final.jar
new file mode 100644
index 0000000..627f7ce
Binary files /dev/null and b/lib/jboss-transaction-api_1.2_spec-1.1.1.Final.jar differ
diff --git a/lib/mysql-connector-java-5.1.40-bin.jar b/lib/mysql-connector-java-5.1.40-bin.jar
new file mode 100644
index 0000000..60bef5c
Binary files /dev/null and b/lib/mysql-connector-java-5.1.40-bin.jar differ
diff --git a/lib/mysql-connector-java-5.1.47.jar b/lib/mysql-connector-java-5.1.47.jar
new file mode 100644
index 0000000..f3398ed
Binary files /dev/null and b/lib/mysql-connector-java-5.1.47.jar differ
diff --git a/lib/stax-ex-1.8.jar b/lib/stax-ex-1.8.jar
new file mode 100644
index 0000000..5e60637
Binary files /dev/null and b/lib/stax-ex-1.8.jar differ
diff --git a/lib/txw2-2.3.1.jar b/lib/txw2-2.3.1.jar
new file mode 100644
index 0000000..75ed519
Binary files /dev/null and b/lib/txw2-2.3.1.jar differ
diff --git a/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/Connect/Connect.class b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/Connect/Connect.class
new file mode 100644
index 0000000..e4b2200
Binary files /dev/null and b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/Connect/Connect.class differ
diff --git a/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/META-INF/HibernateDamo.kotlin_module b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/META-INF/HibernateDamo.kotlin_module
new file mode 100644
index 0000000..2983af7
Binary files /dev/null and b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/META-INF/HibernateDamo.kotlin_module differ
diff --git a/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/Main.class b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/Main.class
new file mode 100644
index 0000000..d55e655
Binary files /dev/null and b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/Main.class differ
diff --git a/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/hibernate.cfg.xml b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/hibernate.cfg.xml
new file mode 100644
index 0000000..3df5d08
--- /dev/null
+++ b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/hibernate.cfg.xml
@@ -0,0 +1,27 @@
+
+
+
+
+ jdbc:mysql://localhost:3306/xianshu
+ com.mysql.jdbc.Driver
+
+ root
+ 123456
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/table/BookEntity.class b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/table/BookEntity.class
new file mode 100644
index 0000000..63f8ec6
Binary files /dev/null and b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/table/BookEntity.class differ
diff --git a/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/table/BookEntity.hbm.xml b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/table/BookEntity.hbm.xml
new file mode 100644
index 0000000..dd709b9
--- /dev/null
+++ b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/table/BookEntity.hbm.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/table/OrderEntity.class b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/table/OrderEntity.class
new file mode 100644
index 0000000..8700ff8
Binary files /dev/null and b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/table/OrderEntity.class differ
diff --git a/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/table/OrderEntity.hbm.xml b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/table/OrderEntity.hbm.xml
new file mode 100644
index 0000000..33b7094
--- /dev/null
+++ b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/table/OrderEntity.hbm.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/table/ShopcartEntity.class b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/table/ShopcartEntity.class
new file mode 100644
index 0000000..5cb77b8
Binary files /dev/null and b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/table/ShopcartEntity.class differ
diff --git a/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/table/ShopcartEntity.hbm.xml b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/table/ShopcartEntity.hbm.xml
new file mode 100644
index 0000000..603813b
--- /dev/null
+++ b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/table/ShopcartEntity.hbm.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/table/UserEntity.class b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/table/UserEntity.class
new file mode 100644
index 0000000..d93e263
Binary files /dev/null and b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/table/UserEntity.class differ
diff --git a/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/table/UserEntity.hbm.xml b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/table/UserEntity.hbm.xml
new file mode 100644
index 0000000..a07dd51
--- /dev/null
+++ b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/table/UserEntity.hbm.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/test/AddTest.class b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/test/AddTest.class
new file mode 100644
index 0000000..eb27767
Binary files /dev/null and b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/test/AddTest.class differ
diff --git a/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/test/UploadServlet.class b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/test/UploadServlet.class
new file mode 100644
index 0000000..bb9fcca
Binary files /dev/null and b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/classes/test/UploadServlet.class differ
diff --git a/out/artifacts/HibernateDamo_war_exploded/WEB-INF/web.xml b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/web.xml
new file mode 100644
index 0000000..bf6e93c
--- /dev/null
+++ b/out/artifacts/HibernateDamo_war_exploded/WEB-INF/web.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ This is the description of my J2EE component
+ This is the display name of my J2EE component
+ UploadServlet
+ test.UploadServlet
+
+
+
+ UploadServlet
+ /Upload.action
+
+
\ No newline at end of file
diff --git a/out/artifacts/HibernateDamo_war_exploded/index.jsp b/out/artifacts/HibernateDamo_war_exploded/index.jsp
new file mode 100644
index 0000000..fe2125c
--- /dev/null
+++ b/out/artifacts/HibernateDamo_war_exploded/index.jsp
@@ -0,0 +1,16 @@
+<%--
+ Created by IntelliJ IDEA.
+ User: TANGNAN
+ Date: 2020/1/2
+ Time: 14:21
+ To change this template use File | Settings | File Templates.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+
+ $Title$
+
+
+ $END$
+
+
diff --git a/out/production/HibernateDamo/Connect/Connect.class b/out/production/HibernateDamo/Connect/Connect.class
new file mode 100644
index 0000000..e4b2200
Binary files /dev/null and b/out/production/HibernateDamo/Connect/Connect.class differ
diff --git a/out/production/HibernateDamo/META-INF/HibernateDamo.kotlin_module b/out/production/HibernateDamo/META-INF/HibernateDamo.kotlin_module
new file mode 100644
index 0000000..2983af7
Binary files /dev/null and b/out/production/HibernateDamo/META-INF/HibernateDamo.kotlin_module differ
diff --git a/out/production/HibernateDamo/Main.class b/out/production/HibernateDamo/Main.class
new file mode 100644
index 0000000..d55e655
Binary files /dev/null and b/out/production/HibernateDamo/Main.class differ
diff --git a/out/production/HibernateDamo/hibernate.cfg.xml b/out/production/HibernateDamo/hibernate.cfg.xml
new file mode 100644
index 0000000..3df5d08
--- /dev/null
+++ b/out/production/HibernateDamo/hibernate.cfg.xml
@@ -0,0 +1,27 @@
+
+
+
+
+ jdbc:mysql://localhost:3306/xianshu
+ com.mysql.jdbc.Driver
+
+ root
+ 123456
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/HibernateDamo/table/BookEntity.class b/out/production/HibernateDamo/table/BookEntity.class
new file mode 100644
index 0000000..63f8ec6
Binary files /dev/null and b/out/production/HibernateDamo/table/BookEntity.class differ
diff --git a/out/production/HibernateDamo/table/BookEntity.hbm.xml b/out/production/HibernateDamo/table/BookEntity.hbm.xml
new file mode 100644
index 0000000..dd709b9
--- /dev/null
+++ b/out/production/HibernateDamo/table/BookEntity.hbm.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/HibernateDamo/table/OrderEntity.class b/out/production/HibernateDamo/table/OrderEntity.class
new file mode 100644
index 0000000..8700ff8
Binary files /dev/null and b/out/production/HibernateDamo/table/OrderEntity.class differ
diff --git a/out/production/HibernateDamo/table/OrderEntity.hbm.xml b/out/production/HibernateDamo/table/OrderEntity.hbm.xml
new file mode 100644
index 0000000..33b7094
--- /dev/null
+++ b/out/production/HibernateDamo/table/OrderEntity.hbm.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/HibernateDamo/table/ShopcartEntity.class b/out/production/HibernateDamo/table/ShopcartEntity.class
new file mode 100644
index 0000000..5cb77b8
Binary files /dev/null and b/out/production/HibernateDamo/table/ShopcartEntity.class differ
diff --git a/out/production/HibernateDamo/table/ShopcartEntity.hbm.xml b/out/production/HibernateDamo/table/ShopcartEntity.hbm.xml
new file mode 100644
index 0000000..603813b
--- /dev/null
+++ b/out/production/HibernateDamo/table/ShopcartEntity.hbm.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/HibernateDamo/table/UserEntity.class b/out/production/HibernateDamo/table/UserEntity.class
new file mode 100644
index 0000000..d93e263
Binary files /dev/null and b/out/production/HibernateDamo/table/UserEntity.class differ
diff --git a/out/production/HibernateDamo/table/UserEntity.hbm.xml b/out/production/HibernateDamo/table/UserEntity.hbm.xml
new file mode 100644
index 0000000..a07dd51
--- /dev/null
+++ b/out/production/HibernateDamo/table/UserEntity.hbm.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/HibernateDamo/test/AddTest.class b/out/production/HibernateDamo/test/AddTest.class
new file mode 100644
index 0000000..eb27767
Binary files /dev/null and b/out/production/HibernateDamo/test/AddTest.class differ
diff --git a/out/production/HibernateDamo/test/UploadServlet.class b/out/production/HibernateDamo/test/UploadServlet.class
new file mode 100644
index 0000000..bb9fcca
Binary files /dev/null and b/out/production/HibernateDamo/test/UploadServlet.class differ
diff --git a/src/Connect/Connect.java b/src/Connect/Connect.java
new file mode 100644
index 0000000..b20479b
--- /dev/null
+++ b/src/Connect/Connect.java
@@ -0,0 +1,60 @@
+package Connect;
+
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.cfg.Configuration;
+
+import javax.swing.*;
+import java.sql.*;
+public class Connect {
+ private Statement sql=null;
+ private ResultSet result;
+// private String url="jdbc:mysql://localhost:3306/userinfo?serverTimezone=GMT%2B8";
+// private String user="root";
+// private String passWord ="1996315211cjr";
+ private Connection con=null;
+ private static Connect connect=new Connect("jdbc:mysql://localhost:3306/userinfo?serverTimezone=GMT%2B8","root","1996315211cjr");
+// private Connect con=new Connect(url,user,passWord);
+ public static Connect getCon(){
+ return connect;
+ }
+ private Connect(String url, String user, String passWord){
+ try{
+ Class.forName("com.mysql.jdbc.Driver");
+ }
+ catch(Exception e){
+ System.out.print(e);
+ }
+ try{
+ con = DriverManager.getConnection(url,user,passWord);
+ }
+ catch(SQLException e){
+ System.out.println(e);
+ }
+ }
+ public int getUpdate(String str){
+ int insert=0;
+ try{
+ sql=con.createStatement();
+ insert=sql.executeUpdate(str);
+ }catch(SQLException e){
+ System.out.println(e);
+ }
+ return insert;
+ }
+ public ResultSet getResult(String str){
+ try{
+ sql=con.createStatement();
+ result=sql.executeQuery(str);
+ }catch(SQLException e){
+ System.out.println(e);
+ }
+ return result;
+ }
+ public static Session getConfig(){
+ Configuration configuration = new Configuration();//加载配置信息
+ configuration.configure();
+ SessionFactory sessionFactory=configuration.buildSessionFactory();
+ return sessionFactory.openSession();
+ }
+}
diff --git a/src/JaveBean/Book.java b/src/JaveBean/Book.java
new file mode 100644
index 0000000..a320dee
--- /dev/null
+++ b/src/JaveBean/Book.java
@@ -0,0 +1,86 @@
+package JaveBean;
+
+public class Book {
+ private int bookId;
+ private String bookname;
+ private Double price;
+ private String category;
+ private String imageurl;
+ private Integer sellerId;
+
+ public int getBookId() {
+ return bookId;
+ }
+
+ public void setBookId(int bookId) {
+ this.bookId = bookId;
+ }
+
+ public String getBookname() {
+ return bookname;
+ }
+
+ public void setBookname(String bookname) {
+ this.bookname = bookname;
+ }
+
+ public Double getPrice() {
+ return price;
+ }
+
+ public void setPrice(Double price) {
+ this.price = price;
+ }
+
+ public String getCategory() {
+ return category;
+ }
+
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ public String getImageurl() {
+ return imageurl;
+ }
+
+ public void setImageurl(String imageurl) {
+ this.imageurl = imageurl;
+ }
+
+ public Integer getSellerId() {
+ return sellerId;
+ }
+
+ public void setSellerId(Integer sellerId) {
+ this.sellerId = sellerId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Book book = (Book) o;
+
+ if (bookId != book.bookId) return false;
+ if (bookname != null ? !bookname.equals(book.bookname) : book.bookname != null) return false;
+ if (price != null ? !price.equals(book.price) : book.price != null) return false;
+ if (category != null ? !category.equals(book.category) : book.category != null) return false;
+ if (imageurl != null ? !imageurl.equals(book.imageurl) : book.imageurl != null) return false;
+ if (sellerId != null ? !sellerId.equals(book.sellerId) : book.sellerId != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = bookId;
+ result = 31 * result + (bookname != null ? bookname.hashCode() : 0);
+ result = 31 * result + (price != null ? price.hashCode() : 0);
+ result = 31 * result + (category != null ? category.hashCode() : 0);
+ result = 31 * result + (imageurl != null ? imageurl.hashCode() : 0);
+ result = 31 * result + (sellerId != null ? sellerId.hashCode() : 0);
+ return result;
+ }
+}
diff --git a/src/JaveBean/Order.java b/src/JaveBean/Order.java
new file mode 100644
index 0000000..a602edf
--- /dev/null
+++ b/src/JaveBean/Order.java
@@ -0,0 +1,64 @@
+package JaveBean;
+
+public class Order {
+ private int orderId;
+ private Integer buyerId;
+ private Integer sellerId;
+ private int bookId;
+
+ public int getOrderId() {
+ return orderId;
+ }
+
+ public void setOrderId(int orderId) {
+ this.orderId = orderId;
+ }
+
+ public Integer getBuyerId() {
+ return buyerId;
+ }
+
+ public void setBuyerId(Integer buyerId) {
+ this.buyerId = buyerId;
+ }
+
+ public Integer getSellerId() {
+ return sellerId;
+ }
+
+ public void setSellerId(Integer sellerId) {
+ this.sellerId = sellerId;
+ }
+
+ public int getBookId() {
+ return bookId;
+ }
+
+ public void setBookId(int bookId) {
+ this.bookId = bookId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Order order = (Order) o;
+
+ if (orderId != order.orderId) return false;
+ if (bookId != order.bookId) return false;
+ if (buyerId != null ? !buyerId.equals(order.buyerId) : order.buyerId != null) return false;
+ if (sellerId != null ? !sellerId.equals(order.sellerId) : order.sellerId != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = orderId;
+ result = 31 * result + (buyerId != null ? buyerId.hashCode() : 0);
+ result = 31 * result + (sellerId != null ? sellerId.hashCode() : 0);
+ result = 31 * result + bookId;
+ return result;
+ }
+}
diff --git a/src/JaveBean/Shopcar.java b/src/JaveBean/Shopcar.java
new file mode 100644
index 0000000..01ab980
--- /dev/null
+++ b/src/JaveBean/Shopcar.java
@@ -0,0 +1,62 @@
+package JaveBean;
+
+public class Shopcar {
+ private int userId;
+ private Integer bookid;
+ private Integer number;
+ private int itemid;
+
+ public int getUserId() {
+ return userId;
+ }
+
+ public void setUserId(int userId) {
+ this.userId = userId;
+ }
+
+ public Integer getBookid() {
+ return bookid;
+ }
+
+ public void setBookid(Integer bookid) {
+ this.bookid = bookid;
+ }
+
+ public Integer getNumber() {
+ return number;
+ }
+
+ public void setNumber(Integer number) {
+ this.number = number;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Shopcar shopcar = (Shopcar) o;
+
+ if (userId != shopcar.userId) return false;
+ if (bookid != null ? !bookid.equals(shopcar.bookid) : shopcar.bookid != null) return false;
+ if (number != null ? !number.equals(shopcar.number) : shopcar.number != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = userId;
+ result = 31 * result + (bookid != null ? bookid.hashCode() : 0);
+ result = 31 * result + (number != null ? number.hashCode() : 0);
+ return result;
+ }
+
+ public int getItemid() {
+ return itemid;
+ }
+
+ public void setItemid(int itemid) {
+ this.itemid = itemid;
+ }
+}
diff --git a/src/JaveBean/User.java b/src/JaveBean/User.java
new file mode 100644
index 0000000..7c96f86
--- /dev/null
+++ b/src/JaveBean/User.java
@@ -0,0 +1,75 @@
+package JaveBean;
+
+public class User {
+ private String username;
+ private String password;
+ private String school;
+ private String sex;
+ private int userId;
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getSchool() {
+ return school;
+ }
+
+ public void setSchool(String school) {
+ this.school = school;
+ }
+
+ public String getSex() {
+ return sex;
+ }
+
+ public void setSex(String sex) {
+ this.sex = sex;
+ }
+
+ public int getUserId() {
+ return userId;
+ }
+
+ public void setUserId(int userId) {
+ this.userId = userId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ User user = (User) o;
+
+ if (userId != user.userId) return false;
+ if (username != null ? !username.equals(user.username) : user.username != null) return false;
+ if (password != null ? !password.equals(user.password) : user.password != null) return false;
+ if (school != null ? !school.equals(user.school) : user.school != null) return false;
+ if (sex != null ? !sex.equals(user.sex) : user.sex != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = username != null ? username.hashCode() : 0;
+ result = 31 * result + (password != null ? password.hashCode() : 0);
+ result = 31 * result + (school != null ? school.hashCode() : 0);
+ result = 31 * result + (sex != null ? sex.hashCode() : 0);
+ result = 31 * result + userId;
+ return result;
+ }
+}
diff --git a/src/ShopCar/ShopCartServlet.java b/src/ShopCar/ShopCartServlet.java
new file mode 100644
index 0000000..824a12e
--- /dev/null
+++ b/src/ShopCar/ShopCartServlet.java
@@ -0,0 +1,108 @@
+package ShopCar;
+
+import Connect.Connect;
+import JaveBean.Shopcar;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.query.Query;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+
+public class ShopCartServlet extends HttpServlet {
+ @Override
+ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ if(req.getServletPath().equals("/addBook.do")){
+ addBook(req, resp);
+ }else if(req.getServletPath().equals("/deleteBook.do")){
+ deleteBook(req, resp);
+ }else if(req.getServletPath().equals("/showCart.do")){
+ showShopcar(req,resp);
+ }
+ }
+ private void showShopcar(HttpServletRequest req, HttpServletResponse resp) {
+ HttpSession session=req.getSession();
+ Object obj=session.getAttribute("userID");
+ int userId = 0;
+ if(obj!=null) {
+ userId = (int) obj;
+ System.out.println("userID是"+userId);
+ }
+ Session hSession=Connect.getConfig();
+ Transaction tx=hSession.beginTransaction();
+ String hql = "FROM Shopcar WHERE userId=:userid";
+ Query query = hSession.createQuery(hql);
+ query.setParameter("userid",userId);
+ tx.commit();
+ List results = query.list();
+ System.out.println("购物车中一共有"+results.size());
+ Iterator it=results.iterator();
+ while(it.hasNext()){
+ Shopcar shopcar= (Shopcar) it.next();
+ System.out.println("Bookid"+shopcar.getBookid());
+ System.out.println("Itemid"+shopcar.getItemid());
+ System.out.println("useid"+shopcar.getUserId());
+ }
+ }
+ private void addBook(HttpServletRequest req, HttpServletResponse resp){
+ HttpSession session=req.getSession();
+ Object obj=session.getAttribute("userID");
+ int bookID=10;
+ int userId = 0;
+ if(obj!=null) {
+ userId = (int) obj;
+ System.out.println("userID是"+userId);
+ }
+ Session hSession= Connect.getConfig();
+ if(userId!=0) {
+ System.out.println(" this is ");
+ Transaction tx=hSession.beginTransaction();
+ Shopcar shopCar=new Shopcar();
+ shopCar.setUserId(userId);
+ shopCar.setBookid(bookID);
+ shopCar.setNumber(10);
+ hSession.save(shopCar);
+ tx.commit();
+ }
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ doPost(req, resp);
+ }
+
+ private void deleteBook(HttpServletRequest req,HttpServletResponse resp){
+ HttpSession session=req.getSession();
+ Object obj=session.getAttribute("userID");
+ int bookID=10;
+ int userId = 0;
+ if(obj!=null) {
+ userId = (int) obj;
+ System.out.println("userID是"+userId);
+ }
+ Session hSession= Connect.getConfig();
+ if(userId!=0) {
+ Transaction tx1=hSession.beginTransaction();
+ String hql = "FROM Shopcar WHERE bookid=:bookid AND userId=:userid";
+ Query query = hSession.createQuery(hql);
+ query.setParameter("bookid",bookID);
+ query.setParameter("userid",userId);
+ List results = query.list();
+ tx1.commit();
+ if(results.size()>0){
+ Transaction tx2=hSession.beginTransaction();
+ Shopcar deleteItem= (Shopcar) results.get(0);
+ hSession.delete(deleteItem);
+ tx2.commit();
+ }else{
+ System.out.println("无法删除");
+ }
+ }
+ }
+}
diff --git a/src/test/AddTest.java b/src/test/AddTest.java
new file mode 100644
index 0000000..2193e3f
--- /dev/null
+++ b/src/test/AddTest.java
@@ -0,0 +1,92 @@
+
+package test;
+
+import table.BookEntity;
+import org.hibernate.*;
+import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.service.ServiceRegistry;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.sql.Date;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * 这里是测试类
+ */
+public class AddTest {
+
+ private SessionFactory sessionFactory;
+ private Session session;
+ private Transaction transaction;
+
+
+
+
+ @Before
+ public void init(){
+ //创建配置对象
+ Configuration config = new Configuration().configure();
+ //创建服务注册对象
+ // ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(config.getProperties()).build();(使用这种方法会报错,unkonw Entity 。。。。)
+ ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().configure().build();
+ //创建会话工厂对象
+
+ sessionFactory = config.buildSessionFactory(serviceRegistry);
+ //创建会话对象
+ session = sessionFactory.openSession();
+ //开启事务
+ transaction = session.beginTransaction();
+ }
+
+
+ @Test
+ public void testAddBook(){
+ BookEntity s = new BookEntity();
+ s.setBookid(7);
+ s.setBookname("s哈哈");
+ s.setPrice(10);
+ s.setCategory("英语");
+ session.save(s);//保存对象进入数据库
+ }
+
+// @Test
+ public void testDeleteBook(){
+ BookEntity s =new BookEntity();
+ s.setBookid(5);
+ session.delete(s);
+ }
+
+// @Test
+ public void testSearchBook(){
+ BookEntity s =new BookEntity();
+ //参数是一个字符串,是HQL的查询语句.注意此时的的UserU为大写,为对象的,而不是表的.
+ Query query = session.createQuery("from BookEntity s where s.bookid=1");
+ //使用List方法.
+ List bookList = query.list();
+ //迭代器去迭代.
+ for(Iterator iter = bookList.iterator(); iter.hasNext();)
+ {
+ BookEntity book =(BookEntity) iter.next();
+ System.out.println("id="+book.getBookid() + "price="+book.getPrice());
+ }
+ }
+
+ @After
+ public void destory(){
+ //提交事务
+ transaction.commit();
+ //关闭session
+ try {
+ session.close();
+ }catch(Exception e){
+
+ }
+ //关闭sessionFactory
+ sessionFactory.close();
+ }
+}
diff --git a/src/test/UploadServlet.java b/src/test/UploadServlet.java
new file mode 100644
index 0000000..cb54f7c
--- /dev/null
+++ b/src/test/UploadServlet.java
@@ -0,0 +1,50 @@
+package test;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServlet;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Enumeration;
+import Connect.Connect;
+public class UploadServlet extends HttpServlet{
+
+ private Connect con=Connect.getCon();
+ public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException {
+ request.setCharacterEncoding("gb2312");
+ Enumeration e=request.getParameterNames();
+ while(e.hasMoreElements()){
+ String name=(String)e.nextElement();
+ String value=request.getParameter(name);
+ System.out.println(name + "=" + value);
+ }
+ //String username=request.getParameter("username");
+ //String password=request.getParameter("password");
+ //String sex=request.getParameter("sex");
+ //String school=request.getParameter("school");
+ String bookname=request.getParameter("bookname");
+ String category=request.getParameter("category");
+ String price=request.getParameter("price");
+ //System.out.println(username);
+ //System.out.println(password);
+ //System.out.println(sex);
+ //System.out.println(school);
+ System.out.println(bookname);
+ System.out.println(category);
+ System.out.println(price);
+ response.setContentType("text/html;charset=gb2312");
+ PrintWriter out=response.getWriter();
+ //String sql="insert into user values("+"\""+username+"\""+","+password+","+"\""+school+"\""+","+"\""+sex+"\""+")";
+ // insert into user values(\"username\",password,\"school\",\"sex\")
+ /*System.out.println(sql);
+ int insert=con.getUpdate(sql);
+ if(insert!=0){
+ System.out.println("注册成功");
+ response.sendRedirect("huiyuan.html");
+ }*/
+ }
+ public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
+ doPost(request,response);
+ }
+}
diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml
index 885f5a8..bf6e93c 100644
--- a/web/WEB-INF/web.xml
+++ b/web/WEB-INF/web.xml
@@ -7,24 +7,12 @@
This is the description of my J2EE component
This is the display name of my J2EE component
- RegisterServlet
- Register.RegisterServlet
+ UploadServlet
+ test.UploadServlet
-
- This is the description of my J2EE component
- This is the display name of my J2EE component
- LoginServlet
- Register.LoginServlet
-
-
- RegisterServlet
- /register.action
-
+
- LoginServlet
- /login.action
+ UploadServlet
+ /Upload.action
-
- huiyuan.html
-
\ No newline at end of file
diff --git a/web/index.jsp b/web/index.jsp
index 2905427..fe2125c 100644
--- a/web/index.jsp
+++ b/web/index.jsp
@@ -1,8 +1,8 @@
<%--
Created by IntelliJ IDEA.
- User: dell
- Date: 2019/10/22
- Time: 20:58
+ User: TANGNAN
+ Date: 2020/1/2
+ Time: 14:21
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
@@ -11,6 +11,6 @@
$Title$
- hello word
+ $END$