From 8c6cf75b137a3e55ce16e0062a99aec8b90b3150 Mon Sep 17 00:00:00 2001 From: shuzheng <469741414@qq.com> Date: Wed, 5 Oct 2016 19:33:23 +0800 Subject: [PATCH] add cms-web --- cms/cms-web/pom.xml | 46 ++++ .../zheng/cms/controller/BaseController.java | 15 ++ .../zheng/cms/controller/HelloController.java | 150 +++++++++++ .../zheng/cms/controller/UserController.java | 240 ++++++++++++++++++ .../resources/i18n/messages_en_US.properties | 3 + .../resources/i18n/messages_zh_CN.properties | 3 + .../src/main/resources/log4j.properties | 23 ++ .../src/main/webapp/WEB-INF/jsp/404.jsp | 14 + .../src/main/webapp/WEB-INF/jsp/500.jsp | 41 +++ .../src/main/webapp/WEB-INF/jsp/book/add.jsp | 35 +++ .../src/main/webapp/WEB-INF/jsp/book/list.jsp | 45 ++++ .../main/webapp/WEB-INF/jsp/book/update.jsp | 35 +++ .../main/webapp/WEB-INF/jsp/hello/world.jsp | 14 + .../src/main/webapp/WEB-INF/jsp/index.jsp | 12 + .../main/webapp/WEB-INF/jsp/message/index.jsp | 5 + .../src/main/webapp/WEB-INF/jsp/user/add.jsp | 52 ++++ .../src/main/webapp/WEB-INF/jsp/user/list.jsp | 64 +++++ .../main/webapp/WEB-INF/jsp/user/update.jsp | 42 +++ cms/cms-web/src/main/webapp/WEB-INF/web.xml | 86 +++++++ cms/cms-web/src/main/webapp/index.jsp | 5 + cms/pom.xml | 1 + 21 files changed, 931 insertions(+) create mode 100644 cms/cms-web/pom.xml create mode 100644 cms/cms-web/src/main/java/com/zheng/cms/controller/BaseController.java create mode 100644 cms/cms-web/src/main/java/com/zheng/cms/controller/HelloController.java create mode 100644 cms/cms-web/src/main/java/com/zheng/cms/controller/UserController.java create mode 100644 cms/cms-web/src/main/resources/i18n/messages_en_US.properties create mode 100644 cms/cms-web/src/main/resources/i18n/messages_zh_CN.properties create mode 100644 cms/cms-web/src/main/resources/log4j.properties create mode 100644 cms/cms-web/src/main/webapp/WEB-INF/jsp/404.jsp create mode 100644 cms/cms-web/src/main/webapp/WEB-INF/jsp/500.jsp create mode 100644 cms/cms-web/src/main/webapp/WEB-INF/jsp/book/add.jsp create mode 100644 cms/cms-web/src/main/webapp/WEB-INF/jsp/book/list.jsp create mode 100644 cms/cms-web/src/main/webapp/WEB-INF/jsp/book/update.jsp create mode 100644 cms/cms-web/src/main/webapp/WEB-INF/jsp/hello/world.jsp create mode 100644 cms/cms-web/src/main/webapp/WEB-INF/jsp/index.jsp create mode 100644 cms/cms-web/src/main/webapp/WEB-INF/jsp/message/index.jsp create mode 100644 cms/cms-web/src/main/webapp/WEB-INF/jsp/user/add.jsp create mode 100644 cms/cms-web/src/main/webapp/WEB-INF/jsp/user/list.jsp create mode 100644 cms/cms-web/src/main/webapp/WEB-INF/jsp/user/update.jsp create mode 100644 cms/cms-web/src/main/webapp/WEB-INF/web.xml create mode 100644 cms/cms-web/src/main/webapp/index.jsp diff --git a/cms/cms-web/pom.xml b/cms/cms-web/pom.xml new file mode 100644 index 00000000..4038d900 --- /dev/null +++ b/cms/cms-web/pom.xml @@ -0,0 +1,46 @@ + + + cms + com.zheng + 1.0.0 + + 4.0.0 + cms-web + war + + cms-web Maven Webapp + http://www.zhangshuzheng.cn + + + + + junit + junit + 4.12 + test + + + + javax.servlet + servlet-api + 2.5 + provided + + + javax.servlet + jstl + 1.2 + + + + com.zheng + cms-service + 1.0.0 + jar + + + + cms-web + + diff --git a/cms/cms-web/src/main/java/com/zheng/cms/controller/BaseController.java b/cms/cms-web/src/main/java/com/zheng/cms/controller/BaseController.java new file mode 100644 index 00000000..c6f9c673 --- /dev/null +++ b/cms/cms-web/src/main/java/com/zheng/cms/controller/BaseController.java @@ -0,0 +1,15 @@ +package com.zheng.cms.controller; + +/** + * 控制器基类 + * @author shuzheng + * @date 2016年7月7日 上午10:08:47 + */ +public class BaseController { + + public static final String RESULT = "result"; + public static final String DATA = "data"; + public static final String SUCCESS = "success"; + public static final String FAILED = "failed"; + +} \ No newline at end of file diff --git a/cms/cms-web/src/main/java/com/zheng/cms/controller/HelloController.java b/cms/cms-web/src/main/java/com/zheng/cms/controller/HelloController.java new file mode 100644 index 00000000..e51b3201 --- /dev/null +++ b/cms/cms-web/src/main/java/com/zheng/cms/controller/HelloController.java @@ -0,0 +1,150 @@ +package com.zheng.cms.controller; + +import java.io.File; +import java.io.IOException; +import java.util.Iterator; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang.builder.ReflectionToStringBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; + +import com.zheng.cms.model.User; +import com.zheng.cms.service.impl.UserServiceImpl; + +/** + * 示例controller + * @author shuzheng + * @date 2016年7月6日 下午6:16:00 + */ +@Controller +@RequestMapping("/hello") +public class HelloController { + + private static Logger logger = LoggerFactory.getLogger(HelloController.class); + + private UserServiceImpl userService; + + public void setUserServiceImpl(UserServiceImpl userService) { + this.userService = userService; + } + + @RequestMapping("/index") + public String index() { + // 视图渲染,/WEB-INF/jsp/hello/world.jsp + return "/hello/world"; + } + + // 方法级别的RequestMapping, 限制并缩小了URL路径匹配,同类级别的标签协同工作,最终确定拦截到的URL由那个方法处理 + @RequestMapping("/world") + public String world() { + // 视图渲染,/WEB-INF/jsp/hello/world.jsp + return "/hello/world"; + } + + // 本方法将处理 /hello/view?courseId=123 形式的URL + @RequestMapping(value = "/view", method = RequestMethod.GET) + public String viewCourse(@RequestParam("courseId") Integer courseId, Model model) { + + User user = userService.getMapper().selectByPrimaryKey(courseId); + model.addAttribute(user); + return "course_overview"; + } + + // 本方法将处理 /hello/view2/123 形式的URL + @RequestMapping("/view2/{courseId}") + public String viewCourse2(@PathVariable("courseId") Integer courseId, Map map) { + + User user = userService.getMapper().selectByPrimaryKey(courseId); + map.put("user", user); + return "course_overview"; + } + + // 本方法将处理 /hello/view3?courseId=123 形式的URL + @RequestMapping("/view3") + public String viewCourse3(HttpServletRequest request) { + + Integer courseId = Integer.valueOf(request.getParameter("courseId")); + User user = userService.getMapper().selectByPrimaryKey(courseId); + request.setAttribute("user", user); + + return "course_overview"; + } + + @RequestMapping(value = "/admin", method = RequestMethod.GET, params = "add") + public String createCourse() { + return "course_admin/edit"; + } + + @RequestMapping(value = "/save", method = RequestMethod.POST) + public String doSave(@ModelAttribute User user) { + + logger.debug("Info of Course:"); + logger.debug(ReflectionToStringBuilder.toString(user)); + + // 在此进行业务操作,比如数据库持久化 + user.setId(123); + return "redirect:view2/" + user.getId(); + } + + @RequestMapping(value = "/upload", method = RequestMethod.GET) + public String showUploadPage(@RequestParam(value = "multi", required = false) Boolean multi) { + if (multi != null && multi) { + return "course_admin/multifile"; + } + return "course_admin/file"; + } + + @RequestMapping(value = "/doUpload", method = RequestMethod.POST) + public String doUploadFile(@RequestParam("file") MultipartFile file) throws IOException { + + if (!file.isEmpty()) { + FileUtils.copyInputStreamToFile(file.getInputStream(), new File("c:\\temp\\imooc\\", System.currentTimeMillis() + file.getOriginalFilename())); + } + + return "success"; + } + + @RequestMapping(value = "/doUpload2", method = RequestMethod.POST) + public String doUploadFile2(MultipartHttpServletRequest multiRequest) throws IOException { + + Iterator filesNames = multiRequest.getFileNames(); + while (filesNames.hasNext()) { + String fileName = filesNames.next(); + MultipartFile file = multiRequest.getFile(fileName); + if (!file.isEmpty()) { + FileUtils.copyInputStreamToFile(file.getInputStream(), new File("c:\\temp\\imooc\\", System.currentTimeMillis() + file.getOriginalFilename())); + } + + } + + return "success"; + } + + @RequestMapping(value = "/{courseId}", method = RequestMethod.GET) + public @ResponseBody + User getCourseInJson(@PathVariable Integer courseId) { + return userService.getMapper().selectByPrimaryKey(courseId); + } + + @RequestMapping(value = "/jsontype/{courseId}", method = RequestMethod.GET) + public ResponseEntity getCourseInJson2(@PathVariable Integer courseId) { + User user = userService.getMapper().selectByPrimaryKey(courseId); + return new ResponseEntity(user, HttpStatus.OK); + } +} \ No newline at end of file diff --git a/cms/cms-web/src/main/java/com/zheng/cms/controller/UserController.java b/cms/cms-web/src/main/java/com/zheng/cms/controller/UserController.java new file mode 100644 index 00000000..9325bc5a --- /dev/null +++ b/cms/cms-web/src/main/java/com/zheng/cms/controller/UserController.java @@ -0,0 +1,240 @@ +package com.zheng.cms.controller; + +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; +import org.springframework.validation.ObjectError; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.multipart.MultipartFile; + +import com.zheng.cms.model.User; +import com.zheng.cms.model.UserExample; +import com.zheng.cms.service.UserService; +import com.zheng.cms.util.Paginator; + +/** + * 用户控制器 + * @author shuzheng + * @date 2016年7月6日 下午6:16:25 + */ +@Controller +@RequestMapping("/user") +public class UserController extends BaseController { + + private static Logger logger = LoggerFactory.getLogger(UserController.class); + + @Autowired + private UserService userService; + + @ExceptionHandler(Exception.class) + public void exceptionHandler(Exception e) { + e.printStackTrace(); + } + + /** + * 首页 + * @return + */ + @RequestMapping(value = {"", "index"}) + public String index() { + return "redirect:/user/list"; + } + + /** + * 列表 + * @param page + * @param rows + * @param request + * @return + */ + @RequestMapping("/list") + public String list( + @RequestParam(required = false, defaultValue = "1") int page, + @RequestParam(required = false, defaultValue = "20") int rows, + HttpServletRequest request) { + // 查询参数 + String clumns = " * "; + String condition = " id>0 "; + String order = " id asc "; + Map parameters = new HashMap(); + parameters.put("clumns", clumns); + parameters.put("condition", condition); + parameters.put("order", order); + // 创建分页对象 + UserExample userExample = new UserExample(); + userExample.createCriteria() + .andIdGreaterThan(0); + long total = userService.getMapper().countByExample(userExample); + Paginator paginator = new Paginator(); + paginator.setTotal(total); + paginator.setPage(page); + paginator.setRows(rows); + paginator.setParam("page"); + paginator.setUrl(request.getRequestURI()); + paginator.setQuery(request.getQueryString()); + // 调用有分页功能的方法 + parameters.put("paginator", paginator); + List users = userService.selectAll(parameters); + // 返回数据 + request.setAttribute("users", users); + request.setAttribute("paginator", paginator); + + + //PageHelper.startPage(1, 10); + return "/user/list"; + } + + /** + * 新增get + * @return + */ + @RequestMapping(value = "/add", method = RequestMethod.GET) + public String add() { + return "/user/add"; + } + + /** + * 新增post + * @param user + * @param binding + * @return + */ + @RequestMapping(value = "/add", method = RequestMethod.POST) + public String add(@Valid User user, BindingResult binding) { + if (binding.hasErrors()) { + for (ObjectError error : binding.getAllErrors()) { + logger.error(error.getDefaultMessage()); + } + return "/user/add"; + } + user.setCtime(System.currentTimeMillis()); + userService.getMapper().insertSelective(user); + return "redirect:/user/list"; + } + + /** + * 新增post2,返回自增主键值 + * @param user + * @param binding + * @return + */ + @RequestMapping(value = "/add2", method = RequestMethod.POST) + public String add2(@Valid User user, BindingResult binding) { + if (binding.hasErrors()) { + return "user/add"; + } + user.setCtime(System.currentTimeMillis()); + userService.insertAutoKey(user); + System.out.println(user.getId()); + return "redirect:/user/list"; + } + + /** + * 删除 + * @param id + * @return + */ + @RequestMapping(value = "/delete/{id}",method = RequestMethod.GET) + public String delete(@PathVariable int id) { + userService.getMapper().deleteByPrimaryKey(id); + return "redirect:/user/list"; + } + + /** + * 修改get + * @param id + * @param model + * @return + */ + @RequestMapping(value = "/update/{id}", method = RequestMethod.GET) + public String update(@PathVariable int id, Model model) { + model.addAttribute("user", userService.getMapper().selectByPrimaryKey(id)); + return "/user/update"; + } + + /** + * 修改post + * @param id + * @param user + * @param binding + * @param model + * @return + */ + @RequestMapping(value = "/update/{id}", method = RequestMethod.POST) + public String update(@PathVariable int id, @Valid User user, BindingResult binding, Model model) { + if (binding.hasErrors()) { + model.addAttribute("errors", binding.getAllErrors()); + return "user/update/" + id; + } + userService.getMapper().updateByPrimaryKeySelective(user); + return "redirect:/user/list"; + } + + /** + * 上传文件 + * @param file + * @param request + * @return + * @throws IOException + */ + @ResponseBody + @RequestMapping(value = "/upload", method = RequestMethod.POST) + public Object upload(@RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request) throws IOException { + // 返回结果 + Map map = new HashMap(); + // 判断上传文件类型 + String contentType = file.getContentType().toLowerCase(); + if ((!contentType.equals("image/jpeg")) && + (!contentType.equals("image/pjpeg")) && + (!contentType.equals("image/png")) && + (!contentType.equals("image/x-png")) && + (!contentType.equals("image/bmp")) && + (!contentType.equals("image/gif"))) { + map.put(RESULT, FAILED); + map.put(DATA, "不支持该类型的文件!"); + return map; + } + // 创建图片目录 + String basePath = request.getSession().getServletContext().getRealPath("/attached"); + String fileName = file.getOriginalFilename(); + String savePath = basePath + "/images/"; + File targetFile = new File(savePath, fileName); + if (!targetFile.exists()) { + targetFile.mkdirs(); + } + // 保存图片 + file.transferTo(targetFile); + map.put(RESULT, SUCCESS); + map.put(DATA, targetFile.getAbsoluteFile()); + return map; + } + + /** + * ajax + * @param id + * @return + */ + @ResponseBody + @RequestMapping(value = "/ajax/{id}", method = RequestMethod.GET) + public Object ajax(@PathVariable int id) { + return userService.getMapper().selectByPrimaryKey(id); + } + +} \ No newline at end of file diff --git a/cms/cms-web/src/main/resources/i18n/messages_en_US.properties b/cms/cms-web/src/main/resources/i18n/messages_en_US.properties new file mode 100644 index 00000000..e18706b7 --- /dev/null +++ b/cms/cms-web/src/main/resources/i18n/messages_en_US.properties @@ -0,0 +1,3 @@ +user.list=User List +user.username.null=username can not be null\! +user.username.length=username length must between {min}~{max}! diff --git a/cms/cms-web/src/main/resources/i18n/messages_zh_CN.properties b/cms/cms-web/src/main/resources/i18n/messages_zh_CN.properties new file mode 100644 index 00000000..9ecd66e9 --- /dev/null +++ b/cms/cms-web/src/main/resources/i18n/messages_zh_CN.properties @@ -0,0 +1,3 @@ +user.list=\u7528\u6237\u5217\u8868 +user.username.null=\u5E10\u53F7\u4E0D\u80FD\u4E3A\u7A7A\uFF01 +user.username.length=\u5E10\u53F7\u957F\u5EA6\u5FC5\u987B\u5728{min}~{max}\u4E4B\u95F4\uFF01 diff --git a/cms/cms-web/src/main/resources/log4j.properties b/cms/cms-web/src/main/resources/log4j.properties new file mode 100644 index 00000000..7abffd9f --- /dev/null +++ b/cms/cms-web/src/main/resources/log4j.properties @@ -0,0 +1,23 @@ +#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 + +# MyBatis logging configuration +log4j.logger.com.zheng.cms.mapper=debug +#log4j.logger.com.zheng.cms.mapper.UserMapper=debug +#log4j.logger.com.zheng.cms.mapper.UserMapper.selectUser=debug \ No newline at end of file diff --git a/cms/cms-web/src/main/webapp/WEB-INF/jsp/404.jsp b/cms/cms-web/src/main/webapp/WEB-INF/jsp/404.jsp new file mode 100644 index 00000000..b2c4cf13 --- /dev/null +++ b/cms/cms-web/src/main/webapp/WEB-INF/jsp/404.jsp @@ -0,0 +1,14 @@ +<%@ 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"%> + + + + +404 + + +404 + + \ No newline at end of file diff --git a/cms/cms-web/src/main/webapp/WEB-INF/jsp/500.jsp b/cms/cms-web/src/main/webapp/WEB-INF/jsp/500.jsp new file mode 100644 index 00000000..fafe7611 --- /dev/null +++ b/cms/cms-web/src/main/webapp/WEB-INF/jsp/500.jsp @@ -0,0 +1,41 @@ +<%@ page contentType="text/html; charset=utf-8" isErrorPage="true"%> +<%@ 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"%> + + + + + +500 + + +
+

错误代码:500<%//=request.getAttribute("javax.servlet.error.status_code")%>

+

您访问的页面有错误!

+

错误原因:${error.message}

+

错误内容:${error}

+

跳转到首页

+
+<% +/** +监控出错人的IP +String ip = request.getHeader(" x-forwarded-for"); +if (ip == null || ip.length() == 0 || " unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader(" Proxy-Client-IP"); // 获取代理ip +} +if (ip == null || ip.length() == 0 || " unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader(" WL-Proxy-Client-IP"); // 获取代理ip +} +if (ip == null || ip.length() == 0 || " unknown".equalsIgnoreCase(ip)) { + ip = request.getRemoteAddr(); // 获取真实ip +} +//out.println(ip+"

你的地址是:

"); + +Document doc = Jsoup.connect("http://ip.chinaz.com/?IP="+ip).timeout(9000).get(); +Element e = doc.select("#status").first(); +//out.println(e); +*/ +%> + + \ No newline at end of file diff --git a/cms/cms-web/src/main/webapp/WEB-INF/jsp/book/add.jsp b/cms/cms-web/src/main/webapp/WEB-INF/jsp/book/add.jsp new file mode 100644 index 00000000..f3ba74c5 --- /dev/null +++ b/cms/cms-web/src/main/webapp/WEB-INF/jsp/book/add.jsp @@ -0,0 +1,35 @@ +<%@ 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"%> + + + + + +添加书籍 + + + +
+
+ + + + + + + + + +
添加书籍
帐号:${user.username}
密码:${user.password}
昵称:${user.nickname}
性别:
书名:*
取消 
+
+
+ + \ No newline at end of file diff --git a/cms/cms-web/src/main/webapp/WEB-INF/jsp/book/list.jsp b/cms/cms-web/src/main/webapp/WEB-INF/jsp/book/list.jsp new file mode 100644 index 00000000..278274f4 --- /dev/null +++ b/cms/cms-web/src/main/webapp/WEB-INF/jsp/book/list.jsp @@ -0,0 +1,45 @@ +<%@ 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"%> + + + + + +书籍列表 + + + +
+ + + + + + + + + + + + + + + + + + +
书籍列表 添加
ID书名操作
${book.id}${book.name} + 修改 + 删除 +
+
${paginator.html}
+
+ + \ No newline at end of file diff --git a/cms/cms-web/src/main/webapp/WEB-INF/jsp/book/update.jsp b/cms/cms-web/src/main/webapp/WEB-INF/jsp/book/update.jsp new file mode 100644 index 00000000..912a445c --- /dev/null +++ b/cms/cms-web/src/main/webapp/WEB-INF/jsp/book/update.jsp @@ -0,0 +1,35 @@ +<%@ 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"%> + + + + + +修改书籍 + + + +
+
+ + + + + + + + + +
修改书籍
帐号:${book.user.username}
密码:${book.user.password}
昵称:${book.user.nickname}
性别:
书名:*
取消 
+
+
+ + \ No newline at end of file diff --git a/cms/cms-web/src/main/webapp/WEB-INF/jsp/hello/world.jsp b/cms/cms-web/src/main/webapp/WEB-INF/jsp/hello/world.jsp new file mode 100644 index 00000000..1826f28a --- /dev/null +++ b/cms/cms-web/src/main/webapp/WEB-INF/jsp/hello/world.jsp @@ -0,0 +1,14 @@ +<%@ 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"%> + + + + +你好世界! + + +你好世界! + + \ No newline at end of file diff --git a/cms/cms-web/src/main/webapp/WEB-INF/jsp/index.jsp b/cms/cms-web/src/main/webapp/WEB-INF/jsp/index.jsp new file mode 100644 index 00000000..5b462d99 --- /dev/null +++ b/cms/cms-web/src/main/webapp/WEB-INF/jsp/index.jsp @@ -0,0 +1,12 @@ +<%@ page contentType="text/html; charset=utf-8"%> +<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%> + + + + +首页 + + +首页 + + \ No newline at end of file diff --git a/cms/cms-web/src/main/webapp/WEB-INF/jsp/message/index.jsp b/cms/cms-web/src/main/webapp/WEB-INF/jsp/message/index.jsp new file mode 100644 index 00000000..399753a2 --- /dev/null +++ b/cms/cms-web/src/main/webapp/WEB-INF/jsp/message/index.jsp @@ -0,0 +1,5 @@ +<%@ 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"%> +">${message} \ No newline at end of file diff --git a/cms/cms-web/src/main/webapp/WEB-INF/jsp/user/add.jsp b/cms/cms-web/src/main/webapp/WEB-INF/jsp/user/add.jsp new file mode 100644 index 00000000..cb67f130 --- /dev/null +++ b/cms/cms-web/src/main/webapp/WEB-INF/jsp/user/add.jsp @@ -0,0 +1,52 @@ +<%@ 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"%> + + + + + +添加用户 + + + +
+
+ + + + + + + + + + +
添加用户
帐号:*
密码:*
昵称:*
性别: + +
取消 
+
+
+ + + + + +
修改头像
头像:
+
+
+ + + + \ No newline at end of file diff --git a/cms/cms-web/src/main/webapp/WEB-INF/jsp/user/list.jsp b/cms/cms-web/src/main/webapp/WEB-INF/jsp/user/list.jsp new file mode 100644 index 00000000..7d49b918 --- /dev/null +++ b/cms/cms-web/src/main/webapp/WEB-INF/jsp/user/list.jsp @@ -0,0 +1,64 @@ +<%@ 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"%> + + + + + +<spring:message code="user.list"/> + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
用户列表 添加
ID账号密码昵称性别创建时间操作
${user.id}${user.username}${user.password}${user.nickname} + + + + <%-- + + + --%> + ${user.ctime} + + 书籍管理 + 修改 + 删除 +
+
${paginator.html}
+
+ + \ No newline at end of file diff --git a/cms/cms-web/src/main/webapp/WEB-INF/jsp/user/update.jsp b/cms/cms-web/src/main/webapp/WEB-INF/jsp/user/update.jsp new file mode 100644 index 00000000..50f9241c --- /dev/null +++ b/cms/cms-web/src/main/webapp/WEB-INF/jsp/user/update.jsp @@ -0,0 +1,42 @@ +<%@ 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"%> + + + + + +修改用户 + + + +
+
+ + + + + + + + + + +
修改用户
帐号:*
密码:*
昵称:*
性别:* + +
取消 
+
+
+ + \ No newline at end of file diff --git a/cms/cms-web/src/main/webapp/WEB-INF/web.xml b/cms/cms-web/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..a5c07cda --- /dev/null +++ b/cms/cms-web/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,86 @@ + + + + + + CharacterEncodingFilter + org.springframework.web.filter.CharacterEncodingFilter + + encoding + UTF-8 + + + + CharacterEncodingFilter + /* + REQUEST + FORWARD + + + + + org.springframework.web.context.ContextLoaderListener + + + contextConfigLocation + + classpath:applicationContext.xml, + classpath:applicationContext-jdbc.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/* + + + + + 120 + + + + + index.html + index.jsp + + + + + 404 + /WEB-INF/jsp/404.jsp + + + 500 + /WEB-INF/jsp/500.jsp + + \ No newline at end of file diff --git a/cms/cms-web/src/main/webapp/index.jsp b/cms/cms-web/src/main/webapp/index.jsp new file mode 100644 index 00000000..c38169bb --- /dev/null +++ b/cms/cms-web/src/main/webapp/index.jsp @@ -0,0 +1,5 @@ + + +

Hello World!

+ + diff --git a/cms/pom.xml b/cms/pom.xml index 0f2e9bbc..b6cb1e21 100644 --- a/cms/pom.xml +++ b/cms/pom.xml @@ -17,5 +17,6 @@ cms-dao cms-service + cms-web \ No newline at end of file