add cms-web
This commit is contained in:
parent
f7221b2328
commit
8c6cf75b13
|
@ -0,0 +1,46 @@
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>cms</artifactId>
|
||||||
|
<groupId>com.zheng</groupId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>cms-web</artifactId>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
|
||||||
|
<name>cms-web Maven Webapp</name>
|
||||||
|
<url>http://www.zhangshuzheng.cn</url>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- 测试 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.12</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- servlet -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>servlet-api</artifactId>
|
||||||
|
<version>2.5</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>jstl</artifactId>
|
||||||
|
<version>1.2</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- service -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.zheng</groupId>
|
||||||
|
<artifactId>cms-service</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<type>jar</type>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<finalName>cms-web</finalName>
|
||||||
|
</build>
|
||||||
|
</project>
|
|
@ -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";
|
||||||
|
|
||||||
|
}
|
|
@ -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<String, Object> 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<String> 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<User> getCourseInJson2(@PathVariable Integer courseId) {
|
||||||
|
User user = userService.getMapper().selectByPrimaryKey(courseId);
|
||||||
|
return new ResponseEntity<User>(user, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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<String,Object> parameters = new HashMap<String, Object>();
|
||||||
|
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<User> 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<String, Object> map = new HashMap<String, Object>();
|
||||||
|
// 判断上传文件类型
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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}!
|
|
@ -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
|
|
@ -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
|
|
@ -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"%>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
|
<title>404</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
404
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -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"%>
|
||||||
|
<fmt:setLocale value="zh_CN"/>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
||||||
|
<title>500</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<center style="margin:50px auto">
|
||||||
|
<p>错误代码:500<%//=request.getAttribute("javax.servlet.error.status_code")%></p>
|
||||||
|
<p>您访问的页面有错误!</p>
|
||||||
|
<p>错误原因:${error.message}</p>
|
||||||
|
<p>错误内容:${error}</p>
|
||||||
|
<p><!--页面将在<span id="stime">5</span>秒后-->跳转到<a href="${pageContext.request.contextPath}/">首页</a>!</p>
|
||||||
|
</center>
|
||||||
|
<%
|
||||||
|
/**
|
||||||
|
监控出错人的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+"<br/><br/>你的地址是:<br/><br/>");
|
||||||
|
|
||||||
|
Document doc = Jsoup.connect("http://ip.chinaz.com/?IP="+ip).timeout(9000).get();
|
||||||
|
Element e = doc.select("#status").first();
|
||||||
|
//out.println(e);
|
||||||
|
*/
|
||||||
|
%>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -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"%>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
||||||
|
<link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/main.css?v=201509231"/>
|
||||||
|
<title>添加书籍</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="breadcrumb">
|
||||||
|
<span class="crust"><a href="${pageContext.request.contextPath}/" class="crumb">首页</a><span class="arrow"><span>></span></span></span>
|
||||||
|
<span class="crust"><a href="${pageContext.request.contextPath}/user" class="crumb">用户管理</a><span class="arrow"><span>></span></span></span>
|
||||||
|
<span class="crust"><a href="${pageContext.request.contextPath}/user/list" class="crumb">用户列表</a><span class="arrow"><span>></span></span></span>
|
||||||
|
<span class="crust"><a href="${pageContext.request.contextPath}/book/list/${user.id}" class="crumb">书籍列表</a><span class="arrow"><span>></span></span></span>
|
||||||
|
<span class="crust"><a href="" class="crumb">添加书籍</a><span class="arrow"><span>></span></span></span>
|
||||||
|
</div>
|
||||||
|
<div id="main">
|
||||||
|
<form id="form" method="post">
|
||||||
|
<input id="userid" type="hidden" name="userid" value="${user.id}"/>
|
||||||
|
<table border="1">
|
||||||
|
<caption>添加书籍</caption>
|
||||||
|
<tr><td>帐号:</td><td>${user.username}</td></tr>
|
||||||
|
<tr><td>密码:</td><td>${user.password}</td></tr>
|
||||||
|
<tr><td>昵称:</td><td>${user.nickname}</td></tr>
|
||||||
|
<tr><td>性别:</td><td><c:if test="${user.sex==1}">男</c:if><c:if test="${user.sex==2}">女</c:if></td></tr>
|
||||||
|
<tr><td>书名:<font color="#cc0000">*</font></td><td><input id="name" type="text" name="name" placeholder="必填" required="true" maxlength="20" autofocus value=""/></td></tr>
|
||||||
|
<tr><td></td><td><a href="${pageContext.request.contextPath}/book/list/${user.id}">取消</a> <input type="submit" value="保存"/></td></tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -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"%>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
||||||
|
<link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/main.css?v=201509231"/>
|
||||||
|
<title>书籍列表</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="breadcrumb">
|
||||||
|
<span class="crust"><a href="${pageContext.request.contextPath}/" class="crumb">首页</a><span class="arrow"><span>></span></span></span>
|
||||||
|
<span class="crust"><a href="${pageContext.request.contextPath}/user" class="crumb">用户管理</a><span class="arrow"><span>></span></span></span>
|
||||||
|
<span class="crust"><a href="${pageContext.request.contextPath}/user/list" class="crumb">用户列表</a><span class="arrow"><span>></span></span></span>
|
||||||
|
<span class="crust"><a href="" class="crumb">书籍列表</a><span class="arrow"><span>></span></span></span>
|
||||||
|
</div>
|
||||||
|
<div id="main">
|
||||||
|
<table id="datagrid" class="datagrid" border="1">
|
||||||
|
<caption><i class="fa fa-list-ol"></i> 书籍列表 <a href="${pageContext.request.contextPath}/book/add/${id}">添加</a></caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>书名</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<c:forEach var="book" items="${books}">
|
||||||
|
<tr>
|
||||||
|
<td>${book.id}</td>
|
||||||
|
<td>${book.name}</td>
|
||||||
|
<td>
|
||||||
|
<a href="${pageContext.request.contextPath}/book/update/${book.id}">修改</a>
|
||||||
|
<a href="${pageContext.request.contextPath}/book/delete/${user.id}/${book.id}" onclick="return confirm('确认删除吗?');">删除</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</c:forEach>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="pages">${paginator.html}</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -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"%>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
||||||
|
<link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/main.css?v=201509231"/>
|
||||||
|
<title>修改书籍</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="breadcrumb">
|
||||||
|
<span class="crust"><a href="${pageContext.request.contextPath}/" class="crumb">首页</a><span class="arrow"><span>></span></span></span>
|
||||||
|
<span class="crust"><a href="${pageContext.request.contextPath}/user" class="crumb">用户管理</a><span class="arrow"><span>></span></span></span>
|
||||||
|
<span class="crust"><a href="${pageContext.request.contextPath}/user/list" class="crumb">用户列表</a><span class="arrow"><span>></span></span></span>
|
||||||
|
<span class="crust"><a href="${pageContext.request.contextPath}/book/list/${book.user.id}" class="crumb">书籍列表</a><span class="arrow"><span>></span></span></span>
|
||||||
|
<span class="crust"><a href="" class="crumb">修改书籍</a><span class="arrow"><span>></span></span></span>
|
||||||
|
</div>
|
||||||
|
<div id="main">
|
||||||
|
<form id="form" method="post">
|
||||||
|
<input id="userid" type="hidden" name="userid" value="${book.userid}"/>
|
||||||
|
<table border="1">
|
||||||
|
<caption>修改书籍</caption>
|
||||||
|
<tr><td>帐号:</td><td>${book.user.username}</td></tr>
|
||||||
|
<tr><td>密码:</td><td>${book.user.password}</td></tr>
|
||||||
|
<tr><td>昵称:</td><td>${book.user.nickname}</td></tr>
|
||||||
|
<tr><td>性别:</td><td><c:if test="${book.user.sex==1}">男</c:if><c:if test="${book.user.sex==2}">女</c:if></td></tr>
|
||||||
|
<tr><td>书名:<font color="#cc0000">*</font></td><td><input id="name" type="text" name="name" placeholder="必填" required="true" maxlength="20" autofocus value="${book.name}"/></td></tr>
|
||||||
|
<tr><td></td><td><a href="${pageContext.request.contextPath}/book/list/${book.user.id}">取消</a> <input type="submit" value="保存"/></td></tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -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"%>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
||||||
|
<title>你好世界!</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
你好世界!
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,12 @@
|
||||||
|
<%@ page contentType="text/html; charset=utf-8"%>
|
||||||
|
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
||||||
|
<title>首页</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
首页
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -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"%>
|
||||||
|
<a href="<c:url value="/message/index"/>">${message}</a>
|
|
@ -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"%>
|
||||||
|
<c:set var="basePath" value="${pageContext.request.contextPath}"/>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
||||||
|
<title>添加用户</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="breadcrumb">
|
||||||
|
<span class="crust"><a href="${basePath}/" class="crumb">首页</a><span class="arrow"><span>></span></span></span>
|
||||||
|
<span class="crust"><a href="${basePath}/user" class="crumb">用户管理</a><span class="arrow"><span>></span></span></span>
|
||||||
|
<span class="crust"><a href="" class="crumb">添加用户</a><span class="arrow"><span>></span></span></span>
|
||||||
|
</div>
|
||||||
|
<div id="main">
|
||||||
|
<form id="form" method="post">
|
||||||
|
<table border="1">
|
||||||
|
<caption>添加用户</caption>
|
||||||
|
<tr><td>帐号:<font color="#cc0000">*</font></td><td><input id="username" type="text" name="username" placeholder="必填" required="true" maxlength="20" autofocus value=""/></td></tr>
|
||||||
|
<tr><td>密码:<font color="#cc0000">*</font></td><td><input id="password" type="password" name="password" placeholder="必填" required="true" maxlength="20" value=""/></td></tr>
|
||||||
|
<tr><td>昵称:<font color="#cc0000">*</font></td><td><input id="nickname" type="text" name="nickname" placeholder="必填" required="true" maxlength="20" value=""/></td></tr>
|
||||||
|
<tr>
|
||||||
|
<td>性别:</td>
|
||||||
|
<td>
|
||||||
|
<select id="sex" name="sex">
|
||||||
|
<option value="0">-请选择-</option>
|
||||||
|
<option value="1">男</option>
|
||||||
|
<option value="2">女</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td></td><td><a href="${basePath}/user">取消</a> <input type="submit" value="保存"/></td></tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<form id="form2" action="${basePath}/user/upload" method="post" enctype="multipart/form-data">
|
||||||
|
<table border="1">
|
||||||
|
<caption>修改头像</caption>
|
||||||
|
<tr><td>头像:</td><td><input id="file" type="file" name="file"/></td></tr>
|
||||||
|
</tr>
|
||||||
|
<tr><td></td><td><input type="submit" value="上传"/></td></tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<form:errors path="*" cssStyle="color:red"></form:errors>
|
||||||
|
<form:errors path="username" cssClass="errorClass"></form:errors>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -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"%>
|
||||||
|
<c:set var="basePath" value="${pageContext.request.contextPath}"/>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
||||||
|
<title><spring:message code="user.list"/></title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="breadcrumb">
|
||||||
|
<span class="crust"><a href="${basePath}/" class="crumb">首页</a><span class="arrow"><span>></span></span></span>
|
||||||
|
<span class="crust"><a href="${basePath}/user" class="crumb">用户管理</a><span class="arrow"><span>></span></span></span>
|
||||||
|
<span class="crust"><a href="" class="crumb">用户列表</a><span class="arrow"><span>></span></span></span>
|
||||||
|
</div>
|
||||||
|
<div id="main">
|
||||||
|
<table id="datagrid" class="datagrid" border="1">
|
||||||
|
<caption><i class="fa fa-list-ol"></i> 用户列表 <a href="${basePath}/user/add">添加</a></caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>账号</th>
|
||||||
|
<th>密码</th>
|
||||||
|
<th>昵称</th>
|
||||||
|
<th>性别</th>
|
||||||
|
<th>创建时间</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<c:forEach var="user" items="${users}">
|
||||||
|
<tr>
|
||||||
|
<td>${user.id}</td>
|
||||||
|
<td>${user.username}</td>
|
||||||
|
<td>${user.password}</td>
|
||||||
|
<td>${user.nickname}</td>
|
||||||
|
<td>
|
||||||
|
<c:if test="${user.sex==1}">男</c:if>
|
||||||
|
<c:if test="${user.sex==2}">女</c:if>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%--
|
||||||
|
<fmt:parseDate value="${user.ctime}" var="date" pattern="yyyyMMddHHmm"/>
|
||||||
|
<fmt:formatDate value="${date}" type="both" pattern="yyyy-MM-dd HH:mm:ss" timeZone="Asia/Shanghai"/>
|
||||||
|
--%>
|
||||||
|
${user.ctime}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="${basePath}/book/list/${user.id}">书籍管理</a>
|
||||||
|
<a href="${basePath}/user/update/${user.id}">修改</a>
|
||||||
|
<a href="${basePath}/user/delete/${user.id}" onclick="return confirm('确认删除吗?');">删除</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</c:forEach>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="pages">${paginator.html}</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -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"%>
|
||||||
|
<c:set var="basePath" value="${pageContext.request.contextPath}"/>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
||||||
|
<title>修改用户</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="breadcrumb">
|
||||||
|
<span class="crust"><a href="${basePath}/" class="crumb">首页</a><span class="arrow"><span>></span></span></span>
|
||||||
|
<span class="crust"><a href="${basePath}/user" class="crumb">用户管理</a><span class="arrow"><span>></span></span></span>
|
||||||
|
<span class="crust"><a href="" class="crumb">修改用户</a><span class="arrow"><span>></span></span></span>
|
||||||
|
</div>
|
||||||
|
<div id="main">
|
||||||
|
<form id="form" method="post">
|
||||||
|
<table border="1">
|
||||||
|
<caption>修改用户</caption>
|
||||||
|
<tr><td>帐号:<font color="#cc0000">*</font></td><td><input id="username" type="text" name="username" placeholder="必填" required="true" maxlength="20" autofocus value="${user.username}"/></td></tr>
|
||||||
|
<tr><td>密码:<font color="#cc0000">*</font></td><td><input id="password" type="password" name="password" placeholder="必填" required="true" maxlength="20" value="${user.password}"/></td></tr>
|
||||||
|
<tr><td>昵称:<font color="#cc0000">*</font></td><td><input id="nickname" type="text" name="nickname" placeholder="必填" required="true" maxlength="20" value="${user.nickname}"/></td></tr>
|
||||||
|
<tr>
|
||||||
|
<td>性别:<font color="#cc0000">*</font></td>
|
||||||
|
<td>
|
||||||
|
<select id="sex" name="sex">
|
||||||
|
<option value="0">-请选择-</option>
|
||||||
|
<option value="1" <c:if test="${user.sex==1}">selected="selected"</c:if>>男</option>
|
||||||
|
<option value="2" <c:if test="${user.sex==2}">selected="selected"</c:if>>女</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td></td><td><a href="${basePath}/user">取消</a> <input type="submit" value="保存"/></td></tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,86 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||||
|
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||||
|
version="2.5">
|
||||||
|
|
||||||
|
<!-- 强制进行转码 -->
|
||||||
|
<filter>
|
||||||
|
<filter-name>CharacterEncodingFilter</filter-name>
|
||||||
|
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
|
||||||
|
<init-param>
|
||||||
|
<param-name>encoding</param-name>
|
||||||
|
<param-value>UTF-8</param-value>
|
||||||
|
</init-param>
|
||||||
|
</filter>
|
||||||
|
<filter-mapping>
|
||||||
|
<filter-name>CharacterEncodingFilter</filter-name>
|
||||||
|
<url-pattern>/*</url-pattern>
|
||||||
|
<dispatcher>REQUEST</dispatcher>
|
||||||
|
<dispatcher>FORWARD</dispatcher>
|
||||||
|
</filter-mapping>
|
||||||
|
|
||||||
|
<!-- 默认的spring配置文件是在WEB-INF下的applicationContext.xml -->
|
||||||
|
<listener>
|
||||||
|
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||||
|
</listener>
|
||||||
|
<context-param>
|
||||||
|
<param-name>contextConfigLocation</param-name>
|
||||||
|
<param-value>
|
||||||
|
classpath:applicationContext.xml,
|
||||||
|
classpath:applicationContext-jdbc.xml
|
||||||
|
</param-value>
|
||||||
|
</context-param>
|
||||||
|
|
||||||
|
<!-- 日志配置文件 -->
|
||||||
|
<context-param>
|
||||||
|
<param-name>log4jConfigLocation</param-name>
|
||||||
|
<param-value>classpath:log4j.properties</param-value>
|
||||||
|
</context-param>
|
||||||
|
|
||||||
|
<!-- springMVC的核心控制器 -->
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>springMVC</servlet-name>
|
||||||
|
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||||
|
<init-param>
|
||||||
|
<param-name>contextConfigLocation</param-name>
|
||||||
|
<param-value>classpath:springMVC-servlet.xml</param-value>
|
||||||
|
</init-param>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>springMVC</servlet-name>
|
||||||
|
<url-pattern>/</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<!-- Druid连接池监控页面 -->
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>DruidStatView</servlet-name>
|
||||||
|
<servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>DruidStatView</servlet-name>
|
||||||
|
<url-pattern>/druid/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<!-- session配置 -->
|
||||||
|
<session-config>
|
||||||
|
<session-timeout>120</session-timeout>
|
||||||
|
</session-config>
|
||||||
|
|
||||||
|
<!-- 欢迎页面 -->
|
||||||
|
<welcome-file-list>
|
||||||
|
<welcome-file>index.html</welcome-file>
|
||||||
|
<welcome-file>index.jsp</welcome-file>
|
||||||
|
</welcome-file-list>
|
||||||
|
|
||||||
|
<!-- 错误页面 -->
|
||||||
|
<error-page>
|
||||||
|
<error-code>404</error-code>
|
||||||
|
<location>/WEB-INF/jsp/404.jsp</location>
|
||||||
|
</error-page>
|
||||||
|
<error-page>
|
||||||
|
<error-code>500</error-code>
|
||||||
|
<location>/WEB-INF/jsp/500.jsp</location>
|
||||||
|
</error-page>
|
||||||
|
</web-app>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<h2>Hello World!</h2>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -17,5 +17,6 @@
|
||||||
<modules>
|
<modules>
|
||||||
<module>cms-dao</module>
|
<module>cms-dao</module>
|
||||||
<module>cms-service</module>
|
<module>cms-service</module>
|
||||||
|
<module>cms-web</module>
|
||||||
</modules>
|
</modules>
|
||||||
</project>
|
</project>
|
Loading…
Reference in New Issue