From df8d4fdd5fb712abd322553c7c0ed3a484b1f14e Mon Sep 17 00:00:00 2001
From: shuzheng <469741414@qq.com>
Date: Tue, 21 Mar 2017 13:45:18 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95=E6=A8=A1?=
=?UTF-8?q?=E5=9D=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
zheng-test/pom.xml | 111 ++++++++++++++++++
.../test/controller/IndexController.java | 56 +++++++++
.../main/java/com/zheng/test/model/User.java | 47 ++++++++
.../src/main/resources/config.properties | 2 +
.../resources/i18n/messages_en_US.properties | 4 +
.../resources/i18n/messages_zh_CN.properties | 4 +
.../src/main/resources/log4j.properties | 18 +++
.../main/resources/profiles/dev.properties | 2 +
.../main/resources/profiles/pre.properties | 2 +
.../main/resources/profiles/prod.properties | 2 +
.../main/resources/profiles/test.properties | 2 +
.../src/main/resources/springMVC-servlet.xml | 7 ++
.../src/main/webapp/WEB-INF/jsp/index.jsp | 19 +++
.../main/webapp/WEB-INF/thymeleaf/index.html | 16 +++
zheng-test/src/main/webapp/WEB-INF/web.xml | 75 ++++++++++++
zheng-test/src/main/webapp/index.jsp | 5 +
16 files changed, 372 insertions(+)
create mode 100644 zheng-test/pom.xml
create mode 100644 zheng-test/src/main/java/com/zheng/test/controller/IndexController.java
create mode 100644 zheng-test/src/main/java/com/zheng/test/model/User.java
create mode 100644 zheng-test/src/main/resources/config.properties
create mode 100644 zheng-test/src/main/resources/i18n/messages_en_US.properties
create mode 100644 zheng-test/src/main/resources/i18n/messages_zh_CN.properties
create mode 100644 zheng-test/src/main/resources/log4j.properties
create mode 100644 zheng-test/src/main/resources/profiles/dev.properties
create mode 100644 zheng-test/src/main/resources/profiles/pre.properties
create mode 100644 zheng-test/src/main/resources/profiles/prod.properties
create mode 100644 zheng-test/src/main/resources/profiles/test.properties
create mode 100644 zheng-test/src/main/resources/springMVC-servlet.xml
create mode 100644 zheng-test/src/main/webapp/WEB-INF/jsp/index.jsp
create mode 100644 zheng-test/src/main/webapp/WEB-INF/thymeleaf/index.html
create mode 100644 zheng-test/src/main/webapp/WEB-INF/web.xml
create mode 100644 zheng-test/src/main/webapp/index.jsp
diff --git a/zheng-test/pom.xml b/zheng-test/pom.xml
new file mode 100644
index 00000000..13168ac3
--- /dev/null
+++ b/zheng-test/pom.xml
@@ -0,0 +1,111 @@
+
+ 4.0.0
+
+
+ com.zheng
+ zheng-upms
+ 1.0.0
+
+
+ zheng-test
+ war
+
+ zheng-test Maven Webapp
+ http://www.zhangshuzheng.cn
+
+
+
+ com.zheng
+ zheng-common
+ 1.0.0
+
+
+ com.zheng
+ zheng-ui
+ 1.0.0
+
+
+ junit
+ junit
+ 4.12
+ test
+
+
+ javax.servlet
+ servlet-api
+ 2.5
+ provided
+
+
+ javax.servlet
+ jstl
+ 1.2
+
+
+
+
+
+ dev
+
+ dev
+
+
+ true
+
+
+
+ test
+
+ test
+
+
+
+ prod
+
+ prod
+
+
+
+
+
+ zheng-test
+
+ src/main/resources/profiles/${env}.properties
+
+
+
+ src/main/resources
+ true
+
+
+
+
+
+ org.eclipse.jetty
+ jetty-maven-plugin
+
+ 9.2.7.v20150116
+
+ 3
+
+ /
+
+
+ 8888
+
+ automatic
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.18.1
+
+ true
+ true
+
+
+
+
+
diff --git a/zheng-test/src/main/java/com/zheng/test/controller/IndexController.java b/zheng-test/src/main/java/com/zheng/test/controller/IndexController.java
new file mode 100644
index 00000000..3dc55b94
--- /dev/null
+++ b/zheng-test/src/main/java/com/zheng/test/controller/IndexController.java
@@ -0,0 +1,56 @@
+package com.zheng.test.controller;
+
+import com.zheng.common.base.BaseController;
+import com.zheng.test.model.User;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 测试controller
+ * Created by shuzheng on 2017/3/21.
+ */
+@Controller
+public class IndexController extends BaseController {
+
+ private static Logger _log = LoggerFactory.getLogger(IndexController.class);
+
+ /**
+ * jsp视图
+ * @return
+ */
+ @RequestMapping(value = "/jsp", method = RequestMethod.GET)
+ public String jsp() {
+ return "/jsp/index";
+ }
+
+ /**
+ * thymeleaf视图
+ * @param model
+ * @return
+ */
+ @RequestMapping(value = "/thymeleaf", method = RequestMethod.GET)
+ public String thymeleaf(Model model) {
+ model.addAttribute("host", "http://www.zhangshuzheng.cn");
+ List users = new ArrayList<>();
+ User user = new User();
+ user.setId(1l);
+ user.setAge(11);
+ user.setName("zhangsan");
+ users.add(user);
+ user = new User();
+ user.setId(2l);
+ user.setAge(22);
+ user.setName("lisi");
+ users.add(user);
+ model.addAttribute("users", users);
+ return "/index";
+ }
+
+}
\ No newline at end of file
diff --git a/zheng-test/src/main/java/com/zheng/test/model/User.java b/zheng-test/src/main/java/com/zheng/test/model/User.java
new file mode 100644
index 00000000..c3eb4561
--- /dev/null
+++ b/zheng-test/src/main/java/com/zheng/test/model/User.java
@@ -0,0 +1,47 @@
+package com.zheng.test.model;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+/**
+ * Created by ZhangShuzheng on 2016/11/16.
+ */
+@Entity
+public class User {
+
+ @Id
+ @GeneratedValue
+ private Long id;
+
+ @Column(nullable = false)
+ private String name;
+
+ @Column(nullable = false)
+ private Integer age;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Integer getAge() {
+ return age;
+ }
+
+ public void setAge(Integer age) {
+ this.age = age;
+ }
+}
diff --git a/zheng-test/src/main/resources/config.properties b/zheng-test/src/main/resources/config.properties
new file mode 100644
index 00000000..47a8063d
--- /dev/null
+++ b/zheng-test/src/main/resources/config.properties
@@ -0,0 +1,2 @@
+env=${profile.env}
+zheng-ui.version=${zheng-ui.version}
\ No newline at end of file
diff --git a/zheng-test/src/main/resources/i18n/messages_en_US.properties b/zheng-test/src/main/resources/i18n/messages_en_US.properties
new file mode 100644
index 00000000..056877f3
--- /dev/null
+++ b/zheng-test/src/main/resources/i18n/messages_en_US.properties
@@ -0,0 +1,4 @@
+403=Access forbidden!
+404=Page not found!
+500=Internal server error!
+error=Server error!
\ No newline at end of file
diff --git a/zheng-test/src/main/resources/i18n/messages_zh_CN.properties b/zheng-test/src/main/resources/i18n/messages_zh_CN.properties
new file mode 100644
index 00000000..d1c6f767
--- /dev/null
+++ b/zheng-test/src/main/resources/i18n/messages_zh_CN.properties
@@ -0,0 +1,4 @@
+403=\u6CA1\u6709\u6743\u9650\uFF01
+404=\u9875\u9762\u6CA1\u6709\u627E\u5230\uFF01
+500=\u5185\u90E8\u670D\u52A1\u5668\u9519\u8BEF\uFF01
+error=\u670D\u52A1\u5668\u53D1\u751F\u9519\u8BEF\uFF01
\ No newline at end of file
diff --git a/zheng-test/src/main/resources/log4j.properties b/zheng-test/src/main/resources/log4j.properties
new file mode 100644
index 00000000..2fb222a6
--- /dev/null
+++ b/zheng-test/src/main/resources/log4j.properties
@@ -0,0 +1,18 @@
+#off/fatal/error/warn/info/debug/all
+log4j.debug=false
+log4j.rootLogger=info, stdout
+
+# Console output
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n
+
+#Spring logging configuration
+log4j.category.org.springframework = warn
+
+#Druid logging configuration
+log4j.logger.druid.sql=warn,stdout
+log4j.logger.druid.sql.DataSource=warn,stdout
+log4j.logger.druid.sql.Connection=warn,stdout
+log4j.logger.druid.sql.Statement=warn,stdout
+log4j.logger.druid.sql.ResultSet=warn,stdout
\ No newline at end of file
diff --git a/zheng-test/src/main/resources/profiles/dev.properties b/zheng-test/src/main/resources/profiles/dev.properties
new file mode 100644
index 00000000..05de9162
--- /dev/null
+++ b/zheng-test/src/main/resources/profiles/dev.properties
@@ -0,0 +1,2 @@
+profile.env=dev
+zheng-ui.version=1.0.0
\ No newline at end of file
diff --git a/zheng-test/src/main/resources/profiles/pre.properties b/zheng-test/src/main/resources/profiles/pre.properties
new file mode 100644
index 00000000..0ecf3f89
--- /dev/null
+++ b/zheng-test/src/main/resources/profiles/pre.properties
@@ -0,0 +1,2 @@
+profile.env=pre
+zheng-ui.version=1.0.0
\ No newline at end of file
diff --git a/zheng-test/src/main/resources/profiles/prod.properties b/zheng-test/src/main/resources/profiles/prod.properties
new file mode 100644
index 00000000..63aa8440
--- /dev/null
+++ b/zheng-test/src/main/resources/profiles/prod.properties
@@ -0,0 +1,2 @@
+profile.env=prod
+zheng-ui.version=1.0.0
\ No newline at end of file
diff --git a/zheng-test/src/main/resources/profiles/test.properties b/zheng-test/src/main/resources/profiles/test.properties
new file mode 100644
index 00000000..c2eaebb4
--- /dev/null
+++ b/zheng-test/src/main/resources/profiles/test.properties
@@ -0,0 +1,2 @@
+profile.env=test
+zheng-ui.version=1.0.0
\ No newline at end of file
diff --git a/zheng-test/src/main/resources/springMVC-servlet.xml b/zheng-test/src/main/resources/springMVC-servlet.xml
new file mode 100644
index 00000000..7079a2f1
--- /dev/null
+++ b/zheng-test/src/main/resources/springMVC-servlet.xml
@@ -0,0 +1,7 @@
+
+
+
+
\ No newline at end of file
diff --git a/zheng-test/src/main/webapp/WEB-INF/jsp/index.jsp b/zheng-test/src/main/webapp/WEB-INF/jsp/index.jsp
new file mode 100644
index 00000000..6f9182b2
--- /dev/null
+++ b/zheng-test/src/main/webapp/WEB-INF/jsp/index.jsp
@@ -0,0 +1,19 @@
+<%@ page contentType="text/html; charset=utf-8"%>
+<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
+<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
+<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
+
+
+
+
+
+
+
+ index
+
+
+jsp
+
+
\ No newline at end of file
diff --git a/zheng-test/src/main/webapp/WEB-INF/thymeleaf/index.html b/zheng-test/src/main/webapp/WEB-INF/thymeleaf/index.html
new file mode 100644
index 00000000..abc0342e
--- /dev/null
+++ b/zheng-test/src/main/webapp/WEB-INF/thymeleaf/index.html
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+Hello World
+
+
+
\ No newline at end of file
diff --git a/zheng-test/src/main/webapp/WEB-INF/web.xml b/zheng-test/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 00000000..0e9cd0e2
--- /dev/null
+++ b/zheng-test/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,75 @@
+
+
+
+
+
+ CharacterEncodingFilter
+ org.springframework.web.filter.CharacterEncodingFilter
+
+ encoding
+ UTF-8
+
+
+
+ CharacterEncodingFilter
+ /*
+ REQUEST
+ FORWARD
+
+
+
+
+ org.springframework.web.context.ContextLoaderListener
+
+
+ contextConfigLocation
+
+ classpath*:applicationContext*.xml
+
+
+
+
+
+ log4jConfigLocation
+ classpath:log4j.properties
+
+
+
+
+ springMVC
+ org.springframework.web.servlet.DispatcherServlet
+
+ contextConfigLocation
+ classpath*:springMVC-servlet.xml
+
+ 1
+
+
+ springMVC
+ /
+
+
+
+
+ DruidStatView
+ com.alibaba.druid.support.http.StatViewServlet
+
+
+ DruidStatView
+ /druid/*
+
+
+
+
+ 30
+
+
+
+
+ index.html
+
+
+
\ No newline at end of file
diff --git a/zheng-test/src/main/webapp/index.jsp b/zheng-test/src/main/webapp/index.jsp
new file mode 100644
index 00000000..c38169bb
--- /dev/null
+++ b/zheng-test/src/main/webapp/index.jsp
@@ -0,0 +1,5 @@
+
+
+Hello World!
+
+