├── README.md ├── mybatisdemo1.iml ├── pom.xml └── src └── main ├── java └── com │ └── mybatis │ ├── constansts │ └── MybatisConstants.java │ ├── controller │ ├── ExceptionHandlerDemoController.java │ └── UserController.java │ ├── dao │ ├── BaseDao.java │ ├── RoleMapper.java │ ├── UserMapper.java │ └── UserRoleMapper.java │ ├── exception │ ├── CommonException.java │ └── GloabalHandlerException.java │ ├── model │ ├── Role.java │ ├── User.java │ └── UserRole.java │ ├── service │ ├── UserServiceI.java │ └── UserServiceImpl.java │ ├── servlet │ └── Log4jInitServlet.java │ └── util │ ├── DateUtil.java │ ├── FileUtil.java │ ├── MD5Util.java │ ├── MessageSourceHelper.java │ ├── Pager.java │ └── StringUtil.java ├── resources ├── com │ └── mybatis │ │ ├── i18n │ │ ├── ssm_en_US.properties │ │ └── ssm_zh_CN.properties │ │ └── mapping │ │ ├── RoleMapper.xml1 │ │ ├── UserMapper.xml │ │ └── UserRoleMapper.xml1 ├── config.properties ├── log4j.properties ├── log4j.properties.bak ├── log4j.properties.bak2 ├── mybatis-config.xml ├── spring-mvc.xml ├── spring-mybatis.xml └── spring.xml ├── test ├── TestI18n.java ├── TestMybatis.java └── TestSpringMybatis.java └── webapp ├── WEB-INF ├── errorPage │ ├── 404.html │ ├── 404.jsp │ ├── 405.jsp │ ├── 500.jsp │ └── mantaince.html ├── jsp │ ├── finalExample.jsp │ └── testExceptionHandlerDemo.jsp └── web.xml ├── fenYeDemo.jsp ├── finalModal.html ├── index.jsp ├── jqGridDemo.jsp ├── mvcSample.jsp ├── showUser.jsp ├── userModal.html └── vender ├── bootstrap-3.3.5 ├── css │ ├── bootstrap-theme.css │ ├── bootstrap-theme.css.map │ ├── bootstrap-theme.min.css │ ├── bootstrap.css │ ├── bootstrap.css.map │ └── bootstrap.min.css └── js │ ├── bootstrap.js │ ├── bootstrap.min.js │ └── npm.js ├── jqgrid4.8.2 └── css │ ├── jquery-ui-custom.css │ └── ui.jqgrid.css └── jquery └── jquery-2.1.4.js /README.md: -------------------------------------------------------------------------------- 1 | # Spring4Mybatis 2 | 这是一个Spring MVC + Mybatis 的项目,不仅仅只是简单的demo或是增删改查,她将含括很多的方面:尽量抽取basedao,baseService公共部分,做出一个简单的framework,为以后分布式开发提供基础。 3 | 4 | ##内容 5 | >1. Spring的国际化 6 | >2. Spring事务管理(默认只对RuntimeException或是其子类回滚) 7 | >3. 异常处理(ExceptionHandler) 8 | >4. JMS消息处理机制 9 | >5. Mybatis与Spring的整合,并且 10 | >6. Junit 11 | >7. Log4j 12 | >8. SpringMVC整合页面所有操作,form,file,pic,input,radio,checkbox... 13 | 14 | ##遇到问题: 15 | >1. Date类型丢失时分秒-->把date类型定义为String类型,并在插入db时由SimpleDateFormat转换为相应格式 16 | >2. 事务不回滚-->默认只对RuntimeException或是其子类回滚,如果抛出Exception,不会回滚 17 | >3. 静态资源的重写(http://localhost/foo.css 转为http://localhost/static/foo.css ) 18 | 19 | 20 | 访问: 21 | http://localhost:8080/mybatisdemo1/userController/getAllUserWithPage 得到所有的user以分页的方式 22 | http://localhost:8080/mybatisdemo1/fenYeDemo.jsp 直接访问分页页面 23 | http://localhost:8080/mybatisdemo1/userController/globalI18n?lang=zh 国际化 24 | 25 | 26 | 测试:set contextPath = mybatisdemo1 27 | 一、分页页面:http://localhost:8080//fenYeDemo.jsp 28 | 29 | 二、终极页面: 30 | 31 | 三、国际化:http://localhost:8080//userController/globalI18n?lang=zh 32 | 33 | 34 | 四、 测试ExceptionHandler 35 | 主页面:http://localhost:8080//exceptionDemo 36 | 1.仅仅作用于当前class 37 | ExceptionHandlerDemoController.java-->HandlerExceptionForCurClass() 38 | 具体实现:http://localhost:8080/mybatisdemo1/exceptionDemo/test?param=0 39 | 在当前class中加@ExceptionHandler注解,那么当当前class出现异常的时候就会去找ExceptionHanlder的Method,这样就可以处理异常了 40 | e.g. 41 | /** 42 | * 1. 在 @ExceptionHandler 方法的入参中可以加入 Exception 类型的参数, 该参数即对应发生的异常对象 43 | * 2. @ExceptionHandler 方法的入参中不能传入 Map. 若希望把异常信息传导页面上, 需要使用 ModelAndView 作为返回值 44 | * 3. @ExceptionHandler 方法标记的异常有优先级的问题(默认会去找最接近的方法.e.g. 10/0,发生异常时会找ArithmeticException,如果没有再找RuntimeException). 45 | * 4. @ControllerAdvice: 如果在当前 Handler 中找不到 @ExceptionHandler 方法来出来当前方法出现的异常, 46 | * 则将去 @ControllerAdvice 标记的类中查找 @ExceptionHandler 标记的方法来处理异常. 47 | */ 48 | @ExceptionHandler({ArithmeticException.class}) 49 | public String HandlerExceptionForCurClass(Exception ex,HttpServletRequest request){ 50 | logger.error("出异常了:"+ex); 51 | request.setAttribute("exception",ex); 52 | return "WEB-INF/jsp/testExceptionHandlerDemo"; 53 | } 54 | 2.作用于整个项目用@ControllerAdvice 55 | @ControllerAdvice 56 | public class GloabalHandlerException { 57 | private final static Logger logger = Logger.getLogger(GloabalHandlerException.class); 58 | 59 | @ExceptionHandler({RuntimeException.class}) 60 | public String HandlerExceptionForCurClass(Exception ex,HttpServletRequest request){ 61 | logger.error("出异常了,采用Spring的@ControllerAdvice处理异常:"+ex); 62 | request.setAttribute("exception",ex); 63 | return "WEB-INF/jsp/testExceptionHandlerDemo"; 64 | } 65 | } 66 | 3.可以采用自定义的接口实现HandlerExceptionResolver,具体我就没做测试,可以参考:http://www.cnblogs.com/xd502djj/archive/2012/09/24/2700490.html 67 | 68 | 69 | 70 | 71 | errors/error 72 | errors/err 73 | 74 | 75 | 76 | 77 | 500 78 | 404 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /mybatisdemo1.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | file://$MODULE_DIR$/src/main/resources/spring-mybatis.xml 22 | file://$MODULE_DIR$/src/main/resources/spring-mvc.xml 23 | file://$MODULE_DIR$/src/main/resources/spring.xml 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | mybatisdemo1 6 | mybatisdemo1 7 | war 8 | 1.0-SNAPSHOT 9 | mybatisdemo1 Maven Webapp 10 | http://maven.apache.org 11 | 12 | 13 | 4.1.4.RELEASE 14 | 1.7.6 15 | 1.2.17 16 | 5.1.29 17 | 3.2.5 18 | 1.2.2 19 | 1.0.0 20 | 2.6.8 21 | 2.3.20 22 | 2.3.2 23 | 1.7.4 24 | 4.12 25 | 1.0.12 26 | 27 | 28 | 29 | 44 | 45 | 46 | org.springframework 47 | spring-core 48 | ${springframework-version} 49 | 50 | 51 | org.springframework 52 | spring-web 53 | ${springframework-version} 54 | 55 | 56 | commons-logging 57 | commons-logging 58 | 59 | 60 | 61 | 62 | org.springframework 63 | spring-webmvc 64 | ${springframework-version} 65 | 66 | 67 | org.springframework 68 | spring-context-support 69 | ${springframework-version} 70 | 71 | 72 | org.springframework 73 | spring-jdbc 74 | ${springframework-version} 75 | 76 | 77 | org.springframework 78 | spring-orm 79 | ${springframework-version} 80 | 81 | 82 | org.springframework 83 | spring-aop 84 | ${springframework-version} 85 | 86 | 87 | org.springframework.data 88 | spring-data-commons 89 | 1.7.0.RELEASE 90 | 91 | 92 | org.springframework 93 | spring-test 94 | ${springframework-version} 95 | test 96 | 97 | 98 | org.springframework 99 | spring-tx 100 | ${springframework-version} 101 | 102 | 103 | 104 | 105 | org.aspectj 106 | aspectjrt 107 | ${aspectj-version} 108 | 109 | 110 | org.aspectj 111 | aspectjweaver 112 | ${aspectj-version} 113 | 114 | 115 | 116 | 117 | org.mybatis 118 | mybatis 119 | ${mybatis-version} 120 | 121 | 122 | org.mybatis 123 | mybatis-spring 124 | 1.2.2 125 | 126 | 127 | 128 | 129 | mysql 130 | mysql-connector-java 131 | 5.1.34 132 | 133 | 134 | 135 | 136 | com.alibaba 137 | druid 138 | ${alibaba-druid-version} 139 | 140 | 141 | 142 | org.slf4j 143 | slf4j-api 144 | 1.6.1 145 | 146 | 147 | 148 | 149 | junit 150 | junit 151 | ${junit-version} 152 | 153 | 158 | 159 | com.alibaba 160 | fastjson 161 | 1.2.4 162 | 163 | 164 | commons-fileupload 165 | commons-fileupload 166 | 1.3.1 167 | 168 | 169 | 170 | 171 | org.codehaus.jackson 172 | jackson-mapper-asl 173 | 1.9.13 174 | 175 | 176 | com.fasterxml.jackson.core 177 | jackson-core 178 | 2.5.0 179 | 180 | 181 | com.fasterxml.jackson.core 182 | jackson-databind 183 | 2.5.0 184 | 185 | 186 | com.fasterxml.jackson.core 187 | jackson-annotations 188 | 2.5.0 189 | 190 | 191 | 192 | 193 | org.apache.commons 194 | commons-io 195 | 1.3.2 196 | 197 | 198 | 199 | 200 | dom4j 201 | dom4j 202 | 1.6.1 203 | 204 | 205 | 206 | 207 | commons-lang 208 | commons-lang 209 | 2.6 210 | 211 | 212 | 213 | 214 | log4j 215 | log4j 216 | ${log4j-version} 217 | 218 | 219 | 220 | 221 | org.slf4j 222 | slf4j-log4j12 223 | 1.7.10 224 | 225 | 226 | 227 | 228 | javax.servlet 229 | servlet-api 230 | 2.5 231 | provided 232 | 233 | 234 | javax.servlet.jsp 235 | jsp-api 236 | 2.1 237 | provided 238 | 239 | 240 | 241 | 242 | javax.servlet 243 | jstl 244 | 1.2 245 | 246 | 247 | taglibs 248 | standard 249 | 1.1.2 250 | 251 | 252 | 253 | 254 | com.github.pagehelper 255 | pagehelper 256 | 3.7.5 257 | 258 | 259 | 260 | 261 | mybatisdemo1 262 | 263 | 264 | -------------------------------------------------------------------------------- /src/main/java/com/mybatis/constansts/MybatisConstants.java: -------------------------------------------------------------------------------- 1 | package com.mybatis.constansts; 2 | 3 | /** 4 | * Description:This is a Constants Class 5 | * Created on 2015-06-05 上午8:39 6 | * ------------------------------------------------------------------------- 7 | * 版本       修改时间        作者       修改内容  8 | * 1.0.0 上午8:39 Darlen create 9 | * ------------------------------------------------------------------------- 10 | * 11 | * @author Darlen liu 12 | */ 13 | public interface MybatisConstants { 14 | 15 | /**/ 16 | public String log4jInfoLocation = "log4j.appender.Info_File.File"; 17 | public String log4jDebugLocation = "log4j.appender.Debug_File.File"; 18 | public String log4jErrorLocation = "log4j.appender.Error_File.File"; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/mybatis/controller/ExceptionHandlerDemoController.java: -------------------------------------------------------------------------------- 1 | /** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 2 | * ProjectName mybatisdemo1 3 | *  File Name ExceptionHandlerDemoController.java  4 | * ** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 5 | *  Copyright (c) 2015 Darlen . All Rights Reserved.  6 | *  注意: 本内容仅限于XXX公司内部使用,禁止转发 7 | * ** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 8 | * */ 9 | package com.mybatis.controller; 10 | 11 | import org.apache.log4j.Logger; 12 | import org.springframework.stereotype.Controller; 13 | import org.springframework.web.bind.annotation.ExceptionHandler; 14 | import org.springframework.web.bind.annotation.RequestMapping; 15 | import org.springframework.web.bind.annotation.RequestParam; 16 | 17 | import javax.servlet.http.HttpServletRequest; 18 | 19 | /** 20 | * Description. 这是一个测试ExceptionHandler的controller,当出现异常该如何处理 21 | * Created on 2015-07-21 下午10:28 22 | * ------------------------------------------------------------------------- 23 | * 版本       修改时间        作者       修改内容  24 | * 1.0.0 下午10:28 Darlen create 25 | * ------------------------------------------------------------------------- 26 | * 27 | * @author Darlen liu 28 | */ 29 | @Controller 30 | @RequestMapping("/exceptionDemo") 31 | public class ExceptionHandlerDemoController { 32 | private final static Logger logger = Logger.getLogger(ExceptionHandlerDemoController.class); 33 | 34 | /** 35 | * 1. 在 @ExceptionHandler 方法的入参中可以加入 Exception 类型的参数, 该参数即对应发生的异常对象 36 | * 2. @ExceptionHandler 方法的入参中不能传入 Map. 若希望把异常信息传导页面上, 需要使用 ModelAndView 作为返回值 37 | * 3. @ExceptionHandler 方法标记的异常有优先级的问题(默认会去找最接近的方法.e.g. 10/0,发生异常时会找ArithmeticException,如果没有再找RuntimeException). 38 | * 4. @ControllerAdvice: 如果在当前 Handler 中找不到 @ExceptionHandler 方法来出来当前方法出现的异常, 39 | * 则将去 @ControllerAdvice 标记的类中查找 @ExceptionHandler 标记的方法来处理异常. 40 | */ 41 | // @ExceptionHandler({ArithmeticException.class}) 42 | // public String HandlerExceptionForCurClass(Exception ex,HttpServletRequest request){ 43 | // logger.error("出异常了,采用Spring的@ControllerAdvice处理异常:"+ex); 44 | // request.setAttribute("exception",ex); 45 | // return "WEB-INF/jsp/testExceptionHandlerDemo"; 46 | // } 47 | 48 | @RequestMapping("/test") 49 | public String testHandlerException(@RequestParam(value = "param") int i ){ 50 | logger.info("result [i]="+10/i); 51 | return "WEB-INF/jsp/testExceptionHandlerDemo"; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/mybatis/controller/UserController.java: -------------------------------------------------------------------------------- 1 | /** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 2 | * ProjectName mybatisdemo1 3 | *  File Name UserController.java  4 | * ** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 5 | *  Copyright (c) 2015 Darlen . All Rights Reserved.  6 | *  注意: 本内容仅限于XXX公司内部使用,禁止转发 7 | * ** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 8 | * */ 9 | package com.mybatis.controller; 10 | 11 | import com.alibaba.fastjson.JSON; 12 | import com.github.pagehelper.PageHelper; 13 | import com.github.pagehelper.PageInfo; 14 | import com.mybatis.model.User; 15 | import com.mybatis.service.UserServiceI; 16 | import com.mybatis.util.StringUtil; 17 | import org.apache.log4j.Logger; 18 | import org.springframework.beans.factory.annotation.Autowired; 19 | import org.springframework.context.i18n.LocaleContextHolder; 20 | import org.springframework.stereotype.Controller; 21 | import org.springframework.ui.Model; 22 | import org.springframework.web.bind.annotation.*; 23 | import org.springframework.web.servlet.i18n.SessionLocaleResolver; 24 | import org.springframework.web.util.WebUtils; 25 | 26 | import javax.servlet.http.HttpServletRequest; 27 | import java.util.*; 28 | 29 | /** 30 | * Description. 31 | * Created on 2015-02-05 下午10:20 32 | * ------------------------------------------------------------------------- 33 | * 版本       修改时间        作者       修改内容  34 | * 1.0.0 下午10:20 Darlen create 35 | * ------------------------------------------------------------------------- 36 | * 37 | * @author Darlen liu 38 | */ 39 | @Controller 40 | @RequestMapping("/userController") 41 | public class UserController { 42 | private static Logger logger = Logger.getLogger(UserController.class); 43 | 44 | private UserServiceI userServiceI; 45 | 46 | public UserServiceI getUserServiceI() { 47 | return userServiceI; 48 | } 49 | @Autowired 50 | public void setUserServiceI(UserServiceI userServiceI) { 51 | this.userServiceI = userServiceI; 52 | } 53 | 54 | /** 55 | * 一般形式访问http://localhost:8080/userController/showUser.do?id=3 56 | * @param id 57 | * @param request 58 | * @return 59 | */ 60 | @RequestMapping("/showUser") 61 | public String showUser(String id, HttpServletRequest request){ 62 | User user = userServiceI.getUserById(Integer.valueOf(id)); 63 | request.setAttribute("user",user); 64 | return "showUser"; 65 | } 66 | 67 | /** 68 | * RESTFUL 形式访问http://localhost:8080/userController/showUser1/1.do 69 | * @param id 70 | * @param request 71 | * @return 72 | */ 73 | @RequestMapping("/showUser1/{id}") 74 | public String showUser1(@PathVariable String id, HttpServletRequest request){ 75 | User user = userServiceI.getUserById(Integer.valueOf(id)); 76 | request.setAttribute("user",user); 77 | return "showUser"; 78 | } 79 | 80 | /** 81 | * RESTFUL 形式访问http://localhost:8080/userController/1/showUser2.do 82 | ********return JSON.toJSONString(user); 83 | ********因为在spring-mvc.xml配置了返回JSON格式,所以不用再另外需要转换为JSON格式了, 84 | ********不然在前台获取的时候需要多转换一次JSON对象$.parseJSON() 85 | * @param id 86 | * @param request 87 | * @return 用户对象:后台会直接给转换了JSON对象然后再传到前台 88 | */ 89 | @ResponseBody 90 | @RequestMapping("/{id}/showUser2") 91 | public User showUser2(@PathVariable String id, HttpServletRequest request){ 92 | User user = userServiceI.getUserById(Integer.valueOf(id)); 93 | 94 | return user; 95 | } 96 | 97 | @RequestMapping("/searchUser") 98 | public String getUser(@RequestParam(value="userID") String id,Model model ){ 99 | User user = new User(); 100 | try{ 101 | user = userServiceI.getUserById(Integer.valueOf(id)); 102 | model.addAttribute("user",user); 103 | }catch (Exception e) { 104 | model.addAttribute("errorMsg",e.getMessage()); 105 | logger.error(e); 106 | } 107 | logger.info("######################User ID is " + id + ":" + user ); 108 | return "showUser"; 109 | } 110 | 111 | /** 112 | * RESTFUL 形式访问http://localhost:8080/mybatisdemo1/userController/getAllUserWithPage.do?pageNum=1&pageSize=10 113 | * @param request 114 | * @return 115 | */ 116 | @RequestMapping("/getAllUserWithPage") 117 | public String getAllUserWithPage(HttpServletRequest request){ 118 | 119 | String str_pageNum = request.getParameter("pageNum"); 120 | String str_pageSize = request.getParameter("pageSize"); 121 | int pageNum = 0,pageSize = 0; 122 | try { 123 | pageNum = Integer.parseInt(str_pageNum); 124 | } catch (NumberFormatException e) { 125 | request.setAttribute("err", "页码只能是大于0的整数,请重新输入!"); 126 | } 127 | try { 128 | pageSize = Integer.parseInt(str_pageSize); 129 | } catch (NumberFormatException e) { 130 | request.setAttribute("err", "页面大小只能是大于0的整数,请重新输入!"); 131 | } 132 | List users = new ArrayList(); 133 | try { 134 | PageHelper.startPage(pageNum, pageSize); 135 | List list = userServiceI.getAllUser(); 136 | PageInfo page = new PageInfo(list,3); 137 | request.setAttribute("page", page); 138 | } catch (Exception e) { 139 | request.setAttribute("errorMsg", "查询出错:" + e.getMessage()); 140 | } 141 | JSON.toJSONString(""); 142 | request.setAttribute("pageNum", pageNum); 143 | request.setAttribute("pageSize", pageSize); 144 | request.setAttribute("user",users); 145 | return "fenYeDemo"; 146 | } 147 | 148 | /** 149 | * 更新用户 150 | * @return 1:success;0 fail 151 | */ 152 | @ResponseBody 153 | @RequestMapping("/updateUser") 154 | public String updateUser(HttpServletRequest request){ 155 | String id = request.getParameter("id"); 156 | String name = request.getParameter("name"); 157 | String pwd = request.getParameter("pwd"); 158 | String returnValue = "1"; 159 | try { 160 | User oldUser = userServiceI.getUserById(Integer.valueOf(id)); 161 | logger.info("OldUser:"+JSON.toJSONStringWithDateFormat(oldUser,"yyyy-MM-dd HH:mm:ss")); 162 | oldUser.setName(name); 163 | oldUser.setPwd(pwd); 164 | //oldUser.setUpdateTime(new Date().getTime()); 165 | int num = userServiceI.updByUserID(oldUser); 166 | 167 | if(1!= num){ 168 | returnValue="0"; 169 | } 170 | } catch (Exception e) { 171 | //TODO 加上删除用户的详细信息 172 | logger.error("更新用户失败",e); 173 | request.setAttribute("errorMsg", "查询出错:" + e.getMessage()); 174 | returnValue = e.getMessage(); 175 | } 176 | return returnValue; 177 | } 178 | 179 | /** 180 | * RESTFUL 形式访问http://localhost:8080/mybatisdemo1/userController/29/delUser.do?pageNum=1&pageSize=10 181 | * @param id 182 | * @param request 183 | * @return 184 | */ 185 | @RequestMapping("/{id}/delUser") 186 | public String delUser(@PathVariable String id, HttpServletRequest request){ 187 | String str_pageNum = request.getParameter("pageNum"); 188 | String str_pageSize = request.getParameter("pageSize"); 189 | try { 190 | PageHelper.startPage(Integer.valueOf(str_pageNum), Integer.valueOf(str_pageSize)); 191 | int num = userServiceI.delUserByID(Integer.valueOf(id)); 192 | if(1 == num) { 193 | //TODO 加上删除用户的详细信息 194 | logger.info("删除用户成功:"+id); 195 | List list = userServiceI.getAllUser(); 196 | PageInfo page = new PageInfo(list,3); 197 | request.setAttribute("page", page); 198 | }else{ 199 | logger.error("删除用户失败:"+id); 200 | throw new Exception("删除用户数量为"+num); 201 | } 202 | } catch (Exception e) { 203 | //TODO 加上删除用户的详细信息 204 | logger.error("删除用户失败",e); 205 | request.setAttribute("errorMsg", "删除出错:" + e.getMessage()); 206 | } 207 | return "fenYeDemo"; 208 | } 209 | 210 | /** 211 | * RESTFUL 形式访问http://localhost:8080/mybatisdemo1/userController/batchDelUsers.do 212 | * @param request 213 | * @return 214 | */ 215 | @ResponseBody 216 | @RequestMapping("/batchDelUsers") 217 | public int batchDelUsers( HttpServletRequest request){ 218 | int retVal = 1; 219 | try { 220 | String str_pageNum = request.getParameter("pageNum"); 221 | String str_pageSize = request.getParameter("pageSize"); 222 | String userIDs = request.getParameter("userIDs"); 223 | if(StringUtil.isEmpty(str_pageNum) || StringUtil.isEmpty(str_pageSize) 224 | || StringUtil.isEmpty(userIDs)){ 225 | logger.error("pageNum 或 pageSize 或 UserIDs不能为空。"); 226 | throw new Exception("pageNum 或 pageSize 或 UserIDs不能为空。"); 227 | } 228 | PageHelper.startPage(Integer.valueOf(str_pageNum), Integer.valueOf(str_pageSize)); 229 | int num = userServiceI.batchDelUserByIDs(Arrays.asList(userIDs.split(","))); 230 | if(num > 0 ) { 231 | logger.info("删除"+num+"个用户成功" + userIDs); 232 | List list = userServiceI.getAllUser(); 233 | PageInfo page = new PageInfo(list,3); 234 | request.setAttribute("page", page); 235 | }else{ 236 | logger.error("删除多个用户失败"); 237 | throw new Exception("删除用户数量为"+num); 238 | } 239 | } catch (Exception e) { 240 | //TODO 加上删除用户的详细信息 241 | logger.error("删除多个用户失败",e); 242 | retVal = 0; 243 | request.setAttribute("errorMsg", "查询出错:" + e.getMessage()); 244 | } 245 | return retVal; 246 | } 247 | 248 | /** 249 | * 为国际化设置session级别的locale 250 | * @param request 251 | * @param model 252 | * @param langType 默认是en 253 | * @return 254 | */ 255 | @RequestMapping(value ="/globalI18n",method = {RequestMethod.GET}) 256 | public String globalI18n(HttpServletRequest request,Model model, @RequestParam(value="lang", defaultValue="en") String langType){ 257 | Object obj = WebUtils.getSessionAttribute(request, SessionLocaleResolver.LOCALE_SESSION_ATTRIBUTE_NAME); 258 | if(null != request.getParameter("lang") ){//如果传递了参数lang,则需要设置locale into session 259 | if(langType.equals("zh")){ 260 | Locale locale = new Locale("zh", "CN"); 261 | request.getSession().setAttribute(SessionLocaleResolver.LOCALE_SESSION_ATTRIBUTE_NAME,locale); 262 | } 263 | else if(langType.equals("en")){ 264 | Locale locale = new Locale("en", "US"); 265 | request.getSession().setAttribute(SessionLocaleResolver.LOCALE_SESSION_ATTRIBUTE_NAME,locale); 266 | } 267 | else{ 268 | request.getSession().setAttribute(SessionLocaleResolver.LOCALE_SESSION_ATTRIBUTE_NAME, LocaleContextHolder.getLocale()); 269 | } 270 | }else if(null == obj){//如果session is empty,则默认设置英文为当前locale 271 | Locale locale = new Locale("en", "US"); 272 | request.getSession().setAttribute(SessionLocaleResolver.LOCALE_SESSION_ATTRIBUTE_NAME,locale); 273 | } 274 | return "WEB-INF/jsp/finalExample"; 275 | } 276 | 277 | 278 | 279 | } 280 | -------------------------------------------------------------------------------- /src/main/java/com/mybatis/dao/BaseDao.java: -------------------------------------------------------------------------------- 1 | package com.mybatis.dao; 2 | 3 | 4 | import com.mybatis.model.User; 5 | 6 | import java.util.List; 7 | 8 | 9 | /** 10 | * Description. Dao基类,主要是负责操纵数据库增删改查 11 | * Created on 2015-06-13 下午1:15 12 | * ------------------------------------------------------------------------- 13 | * 版本       修改时间        作者       修改内容  14 | * 1.0.0 下午1:15 Darlen create 15 | * ------------------------------------------------------------------------- 16 | * 17 | * @author Darlen liu 18 | */ 19 | public interface BaseDao { 20 | /** 21 | * 根据主键id获取对象 22 | * 23 | * @param id 24 | * @return 25 | */ 26 | public T getObjByID(Integer id); 27 | 28 | /** 29 | * 根据名获取对象 30 | * 31 | * @param name 32 | * @return 对象 33 | */ 34 | public T getObjByName(String name); 35 | 36 | /** 37 | * 获取所有对象 38 | * 39 | * @return 对象 40 | */ 41 | public List getAllObjs(); 42 | 43 | /** 44 | * 根据对象插入*所有字段*到db 45 | * 46 | * @param record 47 | * @return 插入结果(数量) 48 | * @deprecated 已经被删除的方法 49 | */ 50 | public int addObj(User record); 51 | 52 | /** 53 | * 根据对象有选择性的只插入*字段不为空*到db 54 | * 55 | * @param t 对象 56 | * @return 插入结果(数量) 57 | */ 58 | public int addObjSelective(T t); 59 | 60 | /** 61 | * 根据主键ID查询并有选择性的只更新*字段不为空*到db 62 | * 63 | * @param t 64 | * @return 更新结果(数量) 65 | */ 66 | public int updObjByIDSelective(T t); 67 | 68 | /** 69 | * 根据主键ID查询并*更新所有字段*到db 70 | * 71 | * @param t 72 | * @return 更新结果(数量) 73 | * @deprecated 已经被抛弃了的方法 74 | */ 75 | public int updObjByID(T t); 76 | 77 | /** 78 | * 根据主键ID查询并删除对象 79 | * 80 | * @param id 81 | * @return 删除结果(数量) 82 | */ 83 | public int delObjByID(Integer id); 84 | 85 | /** 86 | * 根据主键ID查询并删除对象 87 | * 批量删除ID 88 | * 89 | * @param ids 90 | * @return 删除结果(数量) 91 | */ 92 | public int batchDelObjByIDs(List ids); 93 | 94 | } -------------------------------------------------------------------------------- /src/main/java/com/mybatis/dao/RoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.mybatis.dao; 2 | 3 | 4 | import com.mybatis.model.Role; 5 | 6 | public interface RoleMapper { 7 | int insert(Role record); 8 | 9 | int insertSelective(Role record); 10 | } -------------------------------------------------------------------------------- /src/main/java/com/mybatis/dao/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.mybatis.dao; 2 | 3 | 4 | import com.mybatis.model.User; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | 10 | /** 11 | * Description. 类似于DAO,主要是负责操纵数据库增删改查 12 | * Created on 2015-06-13 下午1:15 13 | * ----------------------------------------------------------------------------------- 14 | * 版本       修改时间        作者       修改内容  15 | * 1.0.0 下午1:15 Darlen create 16 | * ----------------------------------------------------------------------------------- 17 | * 18 | * @author Darlen liu 19 | */ 20 | public interface UserMapper extends BaseDao{ 21 | 22 | 23 | } -------------------------------------------------------------------------------- /src/main/java/com/mybatis/dao/UserRoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.mybatis.dao; 2 | 3 | 4 | import com.mybatis.model.UserRole; 5 | 6 | public interface UserRoleMapper { 7 | int deleteByPrimaryKey(Integer id); 8 | 9 | int insert(UserRole record); 10 | 11 | int insertSelective(UserRole record); 12 | 13 | UserRole selectByPrimaryKey(Integer id); 14 | 15 | int updateByPrimaryKeySelective(UserRole record); 16 | 17 | int updateByPrimaryKey(UserRole record); 18 | } -------------------------------------------------------------------------------- /src/main/java/com/mybatis/exception/CommonException.java: -------------------------------------------------------------------------------- 1 | /** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 2 | * ProjectName mybatisdemo1 3 | *  File Name CommonException.java  4 | * ** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 5 | *  Copyright (c) 2015 Darlen . All Rights Reserved.  6 | *  注意: 本内容仅限于XXX公司内部使用,禁止转发 7 | * ** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 8 | * */ 9 | package com.mybatis.exception; 10 | 11 | /** 12 | * Description. 通用异常类 13 | * Created on 2015-07-01 上午8:32 14 | * ------------------------------------------------------------------------- 15 | * 版本       修改时间        作者       修改内容  16 | * 1.0.0 上午8:32 Darlen create 17 | * ------------------------------------------------------------------------- 18 | * 19 | * @author Darlen liu 20 | */ 21 | public class CommonException extends RuntimeException{ 22 | private static final long serialVersionUID = 1L; 23 | 24 | public CommonException() { 25 | super(); 26 | } 27 | 28 | public CommonException(String message) { 29 | super(message); 30 | } 31 | 32 | public CommonException(Throwable cause) { 33 | super(cause); 34 | } 35 | 36 | public CommonException(String message, Throwable cause) { 37 | super(message, cause); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/mybatis/exception/GloabalHandlerException.java: -------------------------------------------------------------------------------- 1 | /** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 2 | * ProjectName mybatisdemo1 3 | *  File Name GloabalHandlerException.java  4 | * ** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 5 | *  Copyright (c) 2015 Darlen . All Rights Reserved.  6 | *  注意: 本内容仅限于XXX公司内部使用,禁止转发 7 | * ** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 8 | * */ 9 | package com.mybatis.exception; 10 | 11 | import org.apache.log4j.Logger; 12 | import org.springframework.web.bind.annotation.ControllerAdvice; 13 | import org.springframework.web.bind.annotation.ExceptionHandler; 14 | 15 | import javax.servlet.http.HttpServletRequest; 16 | 17 | /** 18 | * Description. 这是一个Spring全局的处理异常的类,用@ControllerAdvice, 19 | * 当发生异常时,在当前controller中找不到处理异常时 20 | * (@ExceptionHandler,详见ExceptionHandlerDemoController.java-->HandlerExceptionForCurClass()) 21 | * 则会在全局查找@ControllerAdvice,然后再处理异常 22 | * Created on 2015-07-21 下午11:23 23 | * ------------------------------------------------------------------------- 24 | * 版本       修改时间        作者       修改内容  25 | * 1.0.0 下午11:23 Darlen create 26 | * ------------------------------------------------------------------------- 27 | * 28 | * @author Darlen liu 29 | */ 30 | @ControllerAdvice 31 | public class GloabalHandlerException { 32 | private final static Logger logger = Logger.getLogger(GloabalHandlerException.class); 33 | 34 | @ExceptionHandler({RuntimeException.class}) 35 | public String HandlerExceptionForCurClass(Exception ex,HttpServletRequest request){ 36 | logger.error("出异常了,采用Spring的@ControllerAdvice处理异常:"+ex); 37 | request.setAttribute("exception",ex); 38 | return "WEB-INF/jsp/testExceptionHandlerDemo"; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/mybatis/model/Role.java: -------------------------------------------------------------------------------- 1 | package com.mybatis.model; 2 | 3 | public class Role { 4 | private Integer id; 5 | 6 | private String rolename; 7 | 8 | public Integer getId() { 9 | return id; 10 | } 11 | 12 | public void setId(Integer id) { 13 | this.id = id; 14 | } 15 | 16 | public String getRolename() { 17 | return rolename; 18 | } 19 | 20 | public void setRolename(String rolename) { 21 | this.rolename = rolename == null ? null : rolename.trim(); 22 | } 23 | } -------------------------------------------------------------------------------- /src/main/java/com/mybatis/model/User.java: -------------------------------------------------------------------------------- 1 | package com.mybatis.model; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | import java.util.List; 6 | 7 | /** 8 | * 用户表 9 | */ 10 | public class User { 11 | private List roles; 12 | 13 | private Integer id; 14 | 15 | private String name; 16 | 17 | private String pwd; 18 | 19 | private Date createTime; 20 | 21 | private String updateTime; 22 | 23 | public Integer getId() { 24 | return id; 25 | } 26 | 27 | public void setId(Integer id) { 28 | this.id = id; 29 | } 30 | 31 | public String getName() { 32 | return name; 33 | } 34 | 35 | public void setName(String name) { 36 | this.name = name == null ? null : name.trim(); 37 | } 38 | 39 | public String getPwd() { 40 | return pwd; 41 | } 42 | 43 | public void setPwd(String pwd) { 44 | this.pwd = pwd == null ? null : pwd.trim(); 45 | } 46 | 47 | public Date getCreateTime() { 48 | return createTime; 49 | } 50 | 51 | public void setCreateTime(Date createTime) { 52 | this.createTime = createTime; 53 | } 54 | 55 | public String getUpdateTime() { 56 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 57 | 58 | return updateTime;//sdf.format(updateTime); 59 | } 60 | 61 | public void setUpdateTime(String updateTime) { 62 | this.updateTime = updateTime; 63 | } 64 | 65 | public List getRoles() { 66 | return roles; 67 | } 68 | 69 | public void setRoles(List roles) { 70 | this.roles = roles; 71 | } 72 | 73 | @Override 74 | public String toString() { 75 | return "User{" + 76 | "roles=" + roles + 77 | ", id=" + id + 78 | ", name='" + name + '\'' + 79 | ", pwd='" + pwd + '\'' + 80 | ", createTime=" + createTime + 81 | ", updateTime=" + updateTime + 82 | '}'; 83 | } 84 | } -------------------------------------------------------------------------------- /src/main/java/com/mybatis/model/UserRole.java: -------------------------------------------------------------------------------- 1 | package com.mybatis.model; 2 | 3 | public class UserRole { 4 | private Integer id; 5 | 6 | private Integer tuserid; 7 | 8 | private Integer troleid; 9 | 10 | public Integer getId() { 11 | return id; 12 | } 13 | 14 | public void setId(Integer id) { 15 | this.id = id; 16 | } 17 | 18 | public Integer getTuserid() { 19 | return tuserid; 20 | } 21 | 22 | public void setTuserid(Integer tuserid) { 23 | this.tuserid = tuserid; 24 | } 25 | 26 | public Integer getTroleid() { 27 | return troleid; 28 | } 29 | 30 | public void setTroleid(Integer troleid) { 31 | this.troleid = troleid; 32 | } 33 | } -------------------------------------------------------------------------------- /src/main/java/com/mybatis/service/UserServiceI.java: -------------------------------------------------------------------------------- 1 | /** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 2 | * ProjectName mybatisdemo1 3 | *  File Name UserServiceI.java  4 | * ** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 5 | *  Copyright (c) 2015 Darlen . All Rights Reserved.  6 | *  注意: 本内容仅限于XXX公司内部使用,禁止转发 7 | * ** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 8 | * */ 9 | package com.mybatis.service; 10 | 11 | 12 | import com.mybatis.model.User; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * Description. 18 | * 19 | * Created on 2015-02-03 下午11:02 20 | * ------------------------------------------------------------------------- 21 | * 版本       修改时间        作者       修改内容  22 | * 1.0.0 下午11:02 Darlen create 23 | * ------------------------------------------------------------------------- 24 | * 25 | * @author Darlen liu 26 | */ 27 | public interface UserServiceI { 28 | public User getUserById(int id); 29 | public User getUserByName(String name); 30 | public List getAllUser(); 31 | public int insertUser(User user) throws Exception; 32 | public int updByUserID(User user); 33 | public int delUserByID(int id); 34 | public int batchDelUserByIDs(List ids); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/mybatis/service/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | /** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 2 | * ProjectName mybatisdemo1 3 | *  File Name UserServiceImpl.java  4 | * ** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 5 | *  Copyright (c) 2015 Darlen . All Rights Reserved.  6 | *  注意: 本内容仅限于XXX公司内部使用,禁止转发 7 | * ** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 8 | * */ 9 | package com.mybatis.service; 10 | 11 | import com.mybatis.dao.UserMapper; 12 | import com.mybatis.exception.CommonException; 13 | import com.mybatis.model.User; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.stereotype.*; 16 | 17 | import java.util.List; 18 | 19 | /** 20 | * Description. 21 | * Created on 2015-02-03 下午11:06 22 | * ------------------------------------------------------------------------- 23 | * 版本       修改时间        作者       修改内容  24 | * 1.0.0 下午11:06 Darlen create 25 | * ------------------------------------------------------------------------- 26 | * 27 | * @author Darlen liu 28 | */ 29 | @Service("userService") 30 | public class UserServiceImpl implements UserServiceI{ 31 | @Autowired 32 | private UserMapper userMapper; 33 | 34 | 35 | @Override 36 | public User getUserById(int id) { 37 | return userMapper.getObjByID(id); 38 | } 39 | 40 | @Override 41 | public User getUserByName(String name) { 42 | return userMapper.getObjByName(name); 43 | } 44 | 45 | @Override 46 | public List getAllUser() { 47 | return userMapper.getAllObjs(); 48 | } 49 | 50 | @Override 51 | public int insertUser(User user) throws Exception{ 52 | int num = 0; 53 | try{ 54 | num = userMapper.addObjSelective(user); 55 | //throw new Exception("测试事务回滚:抛出Exception,事务不会回滚####################see roll back or not."); 56 | throw new CommonException("测试事务回滚:抛出RuntimeException,事务会回滚####################see roll back or not."); 57 | }catch (Exception e){ 58 | throw e; 59 | } 60 | // return num; 61 | } 62 | 63 | @Override 64 | public int updByUserID(User user) { 65 | return userMapper.updObjByIDSelective(user); 66 | } 67 | 68 | @Override 69 | public int delUserByID(int id) { 70 | return userMapper.delObjByID(id); 71 | } 72 | 73 | @Override 74 | public int batchDelUserByIDs(List ids) { 75 | return userMapper.batchDelObjByIDs(ids); 76 | } 77 | 78 | 79 | 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/com/mybatis/servlet/Log4jInitServlet.java: -------------------------------------------------------------------------------- 1 | /** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 2 | * ProjectName mybatisdemo1 3 | *  File Name Log4jInitServlet.java  4 | * ** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 5 | *  Copyright (c) 2015 Darlen . All Rights Reserved.  6 | *  注意: 本内容仅限于XXX公司内部使用,禁止转发 7 | * ** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 8 | * */ 9 | package com.mybatis.servlet; 10 | 11 | import com.mybatis.constansts.MybatisConstants; 12 | import org.apache.log4j.Logger; 13 | import org.apache.log4j.PropertyConfigurator; 14 | 15 | import javax.servlet.ServletConfig; 16 | import javax.servlet.ServletException; 17 | import javax.servlet.http.HttpServlet; 18 | import java.io.FileInputStream; 19 | import java.io.FileNotFoundException; 20 | import java.io.IOException; 21 | import java.util.Properties; 22 | 23 | /** 24 | * Description:这是一个Servlet类,目的是用于设置输出log文件的目录 25 | * Created on 2015-06-05 上午8:19 26 | * ------------------------------------------------------------------------- 27 | * 版本       修改时间        作者       修改内容  28 | * 1.0.0 上午8:19 Darlen create 29 | * ------------------------------------------------------------------------- 30 | * 31 | * @author Darlen liu 32 | */ 33 | public class Log4jInitServlet extends HttpServlet{ 34 | 35 | private static Logger logger = Logger.getLogger(Log4jInitServlet.class); 36 | 37 | @Override 38 | public void init(ServletConfig config) throws ServletException { 39 | String prefix = config.getServletContext().getRealPath("/"); 40 | String log4jLocation = config.getInitParameter("log4jInit"); 41 | String absLog4jLocation = prefix+log4jLocation; 42 | logger.debug("###########The absolute log4j location is " + absLog4jLocation); 43 | Properties pro = new Properties(); 44 | try { 45 | FileInputStream fi = new FileInputStream(absLog4jLocation); 46 | pro.load(fi); 47 | fi.close(); 48 | //set the log file location(设置log位置) 49 | String logFileInfoLocation = prefix + pro.getProperty(MybatisConstants.log4jInfoLocation); 50 | String logFileDebugLocation = prefix + pro.getProperty(MybatisConstants.log4jDebugLocation); 51 | String logFileErrorLocation = prefix + pro.getProperty(MybatisConstants.log4jErrorLocation); 52 | pro.setProperty("log4j.appender.Info_File.File",logFileInfoLocation); 53 | pro.setProperty("log4j.appender.Info_File.File",logFileDebugLocation); 54 | pro.setProperty("log4j.appender.Info_File.File",logFileErrorLocation); 55 | logger.debug("##################Log File location:"+logFileInfoLocation); 56 | //设置log4j property 57 | // PropertyConfigurator.configure(pro); 58 | }catch (IOException e) { 59 | logger.error("####################Could not read the log4j.properties file ["+absLog4jLocation+"]"); 60 | logger.error("####################Ignoring the configuration file ["+absLog4jLocation+"]"); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/mybatis/util/DateUtil.java: -------------------------------------------------------------------------------- 1 | /** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 2 | * ProjectName mybatisdemo1 3 | *  File Name DateUtil.java  4 | * ** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 5 | *  Copyright (c) 2015 Darlen . All Rights Reserved.  6 | *  注意: 本内容仅限于XXX公司内部使用,禁止转发 7 | * ** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 8 | * */ 9 | package com.mybatis.util; 10 | 11 | import java.sql.Timestamp; 12 | import java.text.ParseException; 13 | import java.text.SimpleDateFormat; 14 | import java.util.Calendar; 15 | import java.util.Date; 16 | import java.util.HashMap; 17 | import java.util.Map; 18 | 19 | /** 20 | * Description.取得标准格式日期和时间 21 | * Created on 2015-06-13 下午1:15 22 | * ------------------------------------------------------------------------- 23 | * 版本       修改时间        作者       修改内容  24 | * 1.0.0 下午1:15 Darlen create 25 | * ------------------------------------------------------------------------- 26 | * 27 | * @author Darlen liu 28 | */ 29 | public class DateUtil { 30 | /** 31 | * 缺省日期格式 32 | */ 33 | public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd"; 34 | 35 | /** 36 | * 缺省时间格式 37 | */ 38 | public static final String DEFAULT_TIME_FORMAT = "HH:mm:ss"; 39 | 40 | /** 41 | * 缺省月格式 42 | */ 43 | public static final String DEFAULT_MONTH = "MONTH"; 44 | 45 | /** 46 | * 缺省年格式 47 | */ 48 | public static final String DEFAULT_YEAR = "YEAR"; 49 | 50 | /** 51 | * 缺省日格式 52 | */ 53 | public static final String DEFAULT_DATE = "DAY"; 54 | 55 | /** 56 | * 缺省小时格式 57 | */ 58 | public static final String DEFAULT_HOUR = "HOUR"; 59 | 60 | /** 61 | * 缺省分钟格式 62 | */ 63 | public static final String DEFAULT_MINUTE = "MINUTE"; 64 | 65 | /** 66 | * 缺省秒格式 67 | */ 68 | public static final String DEFAULT_SECOND = "SECOND"; 69 | 70 | /** 71 | * 缺省长日期格式 72 | */ 73 | public static final String DEFAULT_DATETIME_FORMAT = "yyyy-MM-dd HH-mm"; 74 | 75 | /** 76 | * 缺省长日期格式,精确到秒 77 | */ 78 | public static final String DEFAULT_DATETIME_FORMAT_SEC = "yyyy-MM-dd HH:mm:ss"; 79 | 80 | /** 81 | * 星期数组 82 | */ 83 | public static final String[] WEEKS = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"}; 84 | 85 | /** 86 | * 取当前日期的字符串表示 87 | * 88 | * @return 当前日期的字符串 ,如2010-05-28 89 | */ 90 | public static String today() { 91 | return today(DEFAULT_DATE_FORMAT); 92 | } 93 | 94 | /** 95 | * 根据输入的格式得到当前日期的字符串 96 | * 97 | * @param strFormat 日期格式 98 | * @return 99 | */ 100 | public static String today(String strFormat) { 101 | return toString(new Date(), strFormat); 102 | } 103 | 104 | /** 105 | * 取当前时间的字符串表示, 106 | * 107 | * @return 当前时间, 如:21:10:12 108 | */ 109 | public static String currentTime() { 110 | return currentTime(DEFAULT_TIME_FORMAT); 111 | } 112 | 113 | /** 114 | * 根据输入的格式获取时间的字符串表示 115 | * 116 | * @param strFormat 输出格式,如'hh:mm:ss' 117 | * @return 当前时间, 如:21:10:12 118 | */ 119 | 120 | public static String currentTime(String strFormat) { 121 | return toString(new Date(), strFormat); 122 | } 123 | 124 | 125 | /** 126 | * 取得相对于当前时间增加天数/月数/年数后的日期 127 | *
128 | * 欲取得当前日期5天前的日期,可做如下调用:
129 | * getAddDay("DATE", -5). 130 | * 131 | * @param field,段,如"year","month","date",对大小写不敏感 132 | * 133 | * @param amount,增加的数量(减少用负数表示),如5,-1 134 | * @return 格式化后的字符串 如"2010-05-28" 135 | * @throws ParseException 136 | */ 137 | 138 | public static String getAddDay(String field, int amount) throws ParseException { 139 | return getAddDay(field, amount, null); 140 | } 141 | 142 | /** 143 | * 取得相对于当前时间增加天数/月数/年数后的日期,按指定格式输出 144 | *

145 | * 欲取得当前日期5天前的日期,可做如下调用:
146 | * getAddDay("DATE", -5,'yyyy-mm-dd hh:mm'). 147 | * 148 | * @param field,段,如"year","month","date",对大小写不敏感 149 | * 150 | * @param amount,增加的数量(减少用负数表示),如5,-1 151 | * @param strFormat,输出格式,如"yyyy-mm-dd","yyyy-mm-dd 152 | * hh:mm" 153 | * @return 格式化后的字符串 如"2010-05-28" 154 | * @throws ParseException 155 | */ 156 | public static String getAddDay(String field, int amount, String strFormat) throws ParseException { 157 | return getAddDay(null, field, amount, strFormat); 158 | } 159 | 160 | /** 161 | * 功能:对于给定的时间增加天数/月数/年数后的日期,按指定格式输出 162 | * 163 | * @param date String 要改变的日期 164 | * @param field int 日期改变的字段,YEAR,MONTH,DAY 165 | * @param amount int 改变量 166 | * @param strFormat 日期返回格式 167 | * @return 168 | * @throws ParseException 169 | */ 170 | public static String getAddDay(String date, String field, int amount, String strFormat) throws ParseException { 171 | if (strFormat == null) { 172 | strFormat = DEFAULT_DATETIME_FORMAT_SEC; 173 | } 174 | Calendar rightNow = Calendar.getInstance(); 175 | if (date != null && !"".equals(date.trim())) { 176 | rightNow.setTime(parseDate(date, strFormat)); 177 | } 178 | if (field == null) { 179 | return toString(rightNow.getTime(), strFormat); 180 | } 181 | rightNow.add(getInterval(field), amount); 182 | return toString(rightNow.getTime(), strFormat); 183 | } 184 | 185 | /** 186 | * 获取时间间隔类型 187 | * 188 | * @param field 时间间隔类型 189 | * @return 日历的时间间隔 190 | */ 191 | protected static int getInterval(String field) { 192 | String tmpField = field.toUpperCase(); 193 | if (tmpField.equals(DEFAULT_YEAR)) { 194 | return Calendar.YEAR; 195 | } else if (tmpField.equals(DEFAULT_MONTH)) { 196 | return Calendar.MONTH; 197 | } else if (tmpField.equals(DEFAULT_DATE)) { 198 | return Calendar.DATE; 199 | } else if (DEFAULT_HOUR.equals(tmpField)) { 200 | return Calendar.HOUR; 201 | } else if (DEFAULT_MINUTE.equals(tmpField)) { 202 | return Calendar.MINUTE; 203 | } else { 204 | return Calendar.SECOND; 205 | } 206 | } 207 | 208 | /** 209 | * 获取格式化对象 210 | * 211 | * @param strFormat 格式化的格式 如"yyyy-MM-dd" 212 | * @return 格式化对象 213 | */ 214 | public static SimpleDateFormat getSimpleDateFormat(String strFormat) { 215 | if (strFormat != null && !"".equals(strFormat.trim())) { 216 | return new SimpleDateFormat(strFormat); 217 | } else { 218 | return new SimpleDateFormat(); 219 | } 220 | } 221 | 222 | /** 223 | * 得到当前日期的星期数 224 | * 225 | * @return 当前日期的星期的字符串 226 | * @throws ParseException 227 | */ 228 | public static String getWeekOfMonth() throws ParseException { 229 | return getWeekOfMonth(null, null); 230 | } 231 | 232 | /** 233 | * 根据日期的到给定日期的在当月中的星期数 234 | * 235 | * @param date 给定日期 236 | * @return 237 | * @throws ParseException 238 | */ 239 | public static String getWeekOfMonth(String date, String fromat) throws ParseException { 240 | Calendar rightNow = Calendar.getInstance(); 241 | if (date != null && !"".equals(date.trim())) { 242 | rightNow.setTime(parseDate(date, fromat)); 243 | } 244 | return WEEKS[rightNow.get(Calendar.WEEK_OF_MONTH)]; 245 | } 246 | 247 | /** 248 | * 将java.util.date型按照指定格式转为字符串 249 | * 250 | * @param date 源对象 251 | * @param format 想得到的格式字符串 252 | * @return 如:2010-05-28 253 | */ 254 | public static String toString(Date date, String format) { 255 | return getSimpleDateFormat(format).format(date); 256 | } 257 | 258 | /** 259 | * 将java.util.date型按照缺省格式转为字符串 260 | * 261 | * @param date 源对象 262 | * @return 如:2010-05-28 263 | */ 264 | public static String toString(Date date) { 265 | return toString(date, DEFAULT_DATE_FORMAT); 266 | } 267 | 268 | 269 | /** 270 | * 强制类型转换 从串到日期 271 | * 272 | * @param strDate 源字符串,采用yyyy-MM-dd格式 273 | * @param format ps 274 | * @return 得到的日期对象 275 | * @throws ParseException 276 | */ 277 | public static Date parseDate(String strDate, String format) throws ParseException { 278 | return getSimpleDateFormat(format).parse(strDate); 279 | } 280 | 281 | 282 | /** 283 | * 根据传入的毫秒数和格式,对日期进行格式化输出 284 | * 285 | * @param millisecond 286 | * @param format 287 | * @return 288 | * @version 2011-7-12 289 | */ 290 | public static String millisecondFormat(Long millisecond, String format) { 291 | if (millisecond == null || millisecond <= 0) { 292 | throw new IllegalArgumentException(String.format("传入的时间毫秒数[%s]不合法", "" + millisecond)); 293 | } 294 | if (format == null || "".equals(format.trim())) { 295 | format = DEFAULT_DATE_FORMAT; 296 | } 297 | return toString(new Date(millisecond), format); 298 | } 299 | 300 | /** 301 | * 强制类型转换 从串到时间戳 302 | * 303 | * @param strDate 源串 304 | * @param format 遵循格式 305 | * @return 取得的时间戳对象 306 | * @throws ParseException . 307 | */ 308 | public static Timestamp parseTimestamp(String strDate, String format) throws ParseException { 309 | Date utildate = getSimpleDateFormat(format).parse(strDate); 310 | return new Timestamp(utildate.getTime()); 311 | } 312 | 313 | /** 314 | * getCurDate 取当前日期 315 | * 316 | * @return java.util.Date型日期 317 | */ 318 | public static Date getCurDate() { 319 | return (new Date()); 320 | } 321 | 322 | /** 323 | * getCurTimestamp 取当前时间戳 324 | * 325 | * @return java.sql.Timestamp 326 | */ 327 | public static Timestamp getCurTimestamp() { 328 | return new Timestamp(new Date().getTime()); 329 | } 330 | 331 | /** 332 | * getCurTimestamp 取遵循格式的当前时间 333 | * 334 | * @param format 遵循格式 335 | * @return java.sql.Timestamp 336 | */ 337 | public static Date getCurDate(String format) throws Exception { 338 | return getSimpleDateFormat(format).parse(toString(new Date(), format)); 339 | } 340 | 341 | 342 | /** 343 | * Timestamp按照指定格式转为字符串 344 | * 345 | * @param timestamp 源对象 346 | * @param format ps(如yyyy.mm.dd) 347 | * @return 如:2010-05-28 或2010-05-281 13:21 348 | */ 349 | public static String toString(Timestamp timestamp, String format) { 350 | if (timestamp == null) { 351 | return ""; 352 | } 353 | return toString(new Date(timestamp.getTime()), format); 354 | } 355 | 356 | /** 357 | * Timestamp按照缺省格式转为字符串 358 | * 359 | * @param ts 源对象 360 | * @return 如:2010-05-28 361 | */ 362 | public static String toString(Timestamp ts) { 363 | return toString(ts, DEFAULT_DATE_FORMAT); 364 | } 365 | 366 | /** 367 | * Timestamp按照缺省格式转为字符串,可指定是否使用长格式 368 | * 369 | * @param timestamp 欲转化之变量Timestamp 370 | * @param fullFormat 是否使用长格式 371 | * @return 如:2010-05-28 或2010-05-28 21:21 372 | */ 373 | public static String toString(Timestamp timestamp, boolean fullFormat) { 374 | if (fullFormat) { 375 | return toString(timestamp, DEFAULT_DATETIME_FORMAT_SEC); 376 | } else { 377 | return toString(timestamp, DEFAULT_DATE_FORMAT); 378 | } 379 | } 380 | 381 | /** 382 | * 将sqldate型按照指定格式转为字符串 383 | * 384 | * @param sqldate 源对象 385 | * @param sFormat ps 386 | * @return 如:2010-05-28 或2010-05-28 00:00 387 | */ 388 | public static String toString(java.sql.Date sqldate, String sFormat) { 389 | if (sqldate == null) { 390 | return ""; 391 | } 392 | return toString(new Date(sqldate.getTime()), sFormat); 393 | } 394 | 395 | /** 396 | * 将sqldate型按照缺省格式转为字符串 397 | * 398 | * @param sqldate 源对象 399 | * @return 如:2010-05-28 400 | */ 401 | public static String toString(java.sql.Date sqldate) { 402 | return toString(sqldate, DEFAULT_DATE_FORMAT); 403 | } 404 | 405 | /** 406 | * 计算日期时间之间的差值, date1得时间必须大于date2的时间 407 | * 408 | * @param date1 409 | * @param date2 410 | * @return {@link java.util.Map} Map的键分别为, day(天), hour(小时),minute(分钟)和second(秒)。 411 | * @version 2011-7-12 412 | */ 413 | public static Map timeDifference(final Date date1, final Date date2) { 414 | if (date1 == null || date2 == null) { 415 | throw new NullPointerException("date1 and date2 can't null"); 416 | } 417 | long mim1 = date1.getTime(); 418 | long mim2 = date2.getTime(); 419 | if (mim1 < mim2) { 420 | throw new IllegalArgumentException(String.format("date1[%s] not be less than date2[%s].", mim1 + "", mim2 + "")); 421 | } 422 | long m = (mim1 - mim2 + 1) / 1000l; 423 | long mday = 24 * 3600; 424 | final Map map = new HashMap(); 425 | map.put("day", m / mday); 426 | m = m % mday; 427 | map.put("hour", (m) / 3600); 428 | map.put("minute", (m % 3600) / 60); 429 | map.put("second", (m % 3600 % 60)); 430 | return map; 431 | } 432 | 433 | public static Map compareTo(final Date date1, final Date date2) { 434 | if (date1 == null || date2 == null) { 435 | return null; 436 | } 437 | long time1 = date1.getTime(); 438 | long time2 = date2.getTime(); 439 | long time = Math.max(time1, time2) - Math.min(time1, time2); 440 | Calendar calendar = Calendar.getInstance(); 441 | calendar.setTimeInMillis(time); 442 | Map map = new HashMap(); 443 | map.put("year", (calendar.get(Calendar.YEAR) - 1970) > 0 ? (calendar.get(Calendar.YEAR) - 1970) : 0); 444 | map.put("month", (calendar.get(Calendar.MONTH) - 1) > 0 ? (calendar.get(Calendar.MONTH) - 1) : 0); 445 | map.put("day", (calendar.get(Calendar.DAY_OF_MONTH) - 1) > 0 ? (calendar.get(Calendar.DAY_OF_MONTH) - 1) : 0); 446 | map.put("hour", (calendar.get(Calendar.HOUR_OF_DAY) - 8) > 0 ? (calendar.get(Calendar.HOUR_OF_DAY) - 8) : 0); 447 | map.put("minute", calendar.get(Calendar.MINUTE) > 0 ? calendar.get(Calendar.MINUTE) : 0); 448 | map.put("second", calendar.get(Calendar.SECOND) > 0 ? calendar.get(Calendar.SECOND) : 0); 449 | return map; 450 | } 451 | } 452 | 453 | 454 | -------------------------------------------------------------------------------- /src/main/java/com/mybatis/util/FileUtil.java: -------------------------------------------------------------------------------- 1 | package com.mybatis.util; 2 | 3 | import java.io.*; 4 | 5 | /** 6 | * File 工具类. 7 | * User: darlenliu 8 | * Date: 14-6-24 9 | * Time: 下午5:27 10 | * 参考IT江湖:http://www.itjhwd.com/javautilhz1/ 11 | */ 12 | public class FileUtil { 13 | private static final String FOLDER_SEPARATOR = "/"; 14 | private static final char EXTENSION_SEPARATOR = '.'; 15 | 16 | /** 17 | * 功能:复制文件或者文件夹。 18 | * 19 | * @author 宋立君 20 | * @date 2014年06月24日 21 | * @param inputFile 22 | * 源文件 23 | * @param outputFile 24 | * 目的文件 25 | * @param isOverWrite 26 | * 是否覆盖(只针对文件) 27 | * @throws java.io.IOException 28 | */ 29 | public static void copy(File inputFile, File outputFile, boolean isOverWrite) 30 | throws IOException { 31 | if (!inputFile.exists()) { 32 | throw new RuntimeException(inputFile.getPath() + "源目录不存在!"); 33 | } 34 | copyPri(inputFile, outputFile, isOverWrite); 35 | } 36 | 37 | /** 38 | * 功能:为copy 做递归使用。 39 | * 40 | * @author 宋立君 41 | * @date 2014年06月24日 42 | * @param inputFile 43 | * @param outputFile 44 | * @param isOverWrite 45 | * @throws java.io.IOException 46 | */ 47 | private static void copyPri(File inputFile, File outputFile, 48 | boolean isOverWrite) throws IOException { 49 | // 是个文件。 50 | if (inputFile.isFile()) { 51 | copySimpleFile(inputFile, outputFile, isOverWrite); 52 | } else { 53 | // 文件夹 54 | if (!outputFile.exists()) { 55 | outputFile.mkdir(); 56 | } 57 | // 循环子文件夹 58 | for (File child : inputFile.listFiles()) { 59 | copy(child, 60 | new File(outputFile.getPath() + "/" + child.getName()), 61 | isOverWrite); 62 | } 63 | } 64 | } 65 | 66 | /** 67 | * 功能:copy单个文件 68 | * 69 | * @author 宋立君 70 | * @date 2014年06月24日 71 | * @param inputFile 72 | * 源文件 73 | * @param outputFile 74 | * 目标文件 75 | * @param isOverWrite 76 | * 是否允许覆盖 77 | * @throws java.io.IOException 78 | */ 79 | private static void copySimpleFile(File inputFile, File outputFile, 80 | boolean isOverWrite) throws IOException { 81 | // 目标文件已经存在 82 | if (outputFile.exists()) { 83 | if (isOverWrite) { 84 | if (!outputFile.delete()) { 85 | throw new RuntimeException(outputFile.getPath() + "无法覆盖!"); 86 | } 87 | } else { 88 | // 不允许覆盖 89 | return; 90 | } 91 | } 92 | InputStream in = new FileInputStream(inputFile); 93 | OutputStream out = new FileOutputStream(outputFile); 94 | byte[] buffer = new byte[1024]; 95 | int read = 0; 96 | while ((read = in.read(buffer)) != -1) { 97 | out.write(buffer, 0, read); 98 | } 99 | in.close(); 100 | out.close(); 101 | } 102 | 103 | /** 104 | * 功能:删除文件 105 | * 106 | * @author 宋立君 107 | * @date 2014年06月24日 108 | * @param file 109 | * 文件 110 | */ 111 | public static void delete(File file) { 112 | deleteFile(file); 113 | } 114 | 115 | /** 116 | * 功能:删除文件,内部递归使用 117 | * 118 | * @author 宋立君 119 | * @date 2014年06月24日 120 | * @param file 121 | * 文件 122 | * @return boolean true 删除成功,false 删除失败。 123 | */ 124 | private static void deleteFile(File file) { 125 | if (file == null || !file.exists()) { 126 | return; 127 | } 128 | // 单文件 129 | if (!file.isDirectory()) { 130 | boolean delFlag = file.delete(); 131 | if (!delFlag) { 132 | throw new RuntimeException(file.getPath() + "删除失败!"); 133 | } else { 134 | return; 135 | } 136 | } 137 | // 删除子目录 138 | for (File child : file.listFiles()) { 139 | deleteFile(child); 140 | } 141 | // 删除自己 142 | file.delete(); 143 | } 144 | 145 | /** 146 | * 从文件路径中抽取文件的扩展名, 例如. "mypath/myfile.txt" -> "txt". * @author 宋立君 147 | * 148 | * @date 2014年06月24日 149 | * @param path 文件路径 150 | * @return 如果path为null,直接返回null。 151 | */ 152 | public static String getFilenameExtension(String path) { 153 | if (path == null) { 154 | return null; 155 | } 156 | int extIndex = path.lastIndexOf(EXTENSION_SEPARATOR); 157 | if (extIndex == -1) { 158 | return null; 159 | } 160 | int folderIndex = path.lastIndexOf(FOLDER_SEPARATOR); 161 | if (folderIndex > extIndex) { 162 | return null; 163 | } 164 | return path.substring(extIndex + 1); 165 | } 166 | 167 | /** 168 | * 从文件路径中抽取文件名, 例如: "mypath/myfile.txt" -> "myfile.txt"。 * @author 宋立君 169 | * 170 | * @date 2014年06月24日 171 | * @param path 172 | * 文件路径。 173 | * @return 抽取出来的文件名, 如果path为null,直接返回null。 174 | */ 175 | public static String getFilename(String path) { 176 | if (path == null) { 177 | return null; 178 | } 179 | int separatorIndex = path.lastIndexOf(FOLDER_SEPARATOR); 180 | return (separatorIndex != -1 ? path.substring(separatorIndex + 1) 181 | : path); 182 | } 183 | 184 | /** 185 | * 功能:保存文件。 186 | * 187 | * @author 宋立君 188 | * @date 2014年06月24日 189 | * @param content 190 | * 字节 191 | * @param file 192 | * 保存到的文件 193 | * @throws java.io.IOException 194 | */ 195 | public static void save(byte[] content, File file) throws IOException { 196 | if (file == null) { 197 | throw new RuntimeException("保存文件不能为空"); 198 | } 199 | if (content == null) { 200 | throw new RuntimeException("文件流不能为空"); 201 | } 202 | InputStream is = new ByteArrayInputStream(content); 203 | save(is, file); 204 | } 205 | 206 | /** 207 | * 功能:保存文件 208 | * 209 | * @author 宋立君 210 | * @date 2014年06月24日 211 | * @param streamIn 212 | * 文件流 213 | * @param file 214 | * 保存到的文件 215 | * @throws java.io.IOException 216 | */ 217 | public static void save(InputStream streamIn, File file) throws IOException { 218 | if (file == null) { 219 | throw new RuntimeException("保存文件不能为空"); 220 | } 221 | if (streamIn == null) { 222 | throw new RuntimeException("文件流不能为空"); 223 | } 224 | // 输出流 225 | OutputStream streamOut = null; 226 | // 文件夹不存在就创建。 227 | if (!file.getParentFile().exists()) { 228 | file.getParentFile().mkdirs(); 229 | } 230 | streamOut = new FileOutputStream(file); 231 | int bytesRead = 0; 232 | byte[] buffer = new byte[8192]; 233 | while ((bytesRead = streamIn.read(buffer, 0, 8192)) != -1) { 234 | streamOut.write(buffer, 0, bytesRead); 235 | } 236 | streamOut.close(); 237 | streamIn.close(); 238 | } 239 | } 240 | -------------------------------------------------------------------------------- /src/main/java/com/mybatis/util/MD5Util.java: -------------------------------------------------------------------------------- 1 | package com.mybatis.util; 2 | 3 | import java.io.File; 4 | import java.io.FileInputStream; 5 | import java.io.IOException; 6 | import java.nio.MappedByteBuffer; 7 | import java.nio.channels.FileChannel; 8 | import java.security.MessageDigest; 9 | import java.security.NoSuchAlgorithmException; 10 | 11 | /** 12 | * MD5 工具类. 13 | * User: darlenliu 14 | * Date: 14-6-24 15 | * Time: 下午5:25 16 | * To change this template use File | Settings | File Templates. 17 | */ 18 | public class MD5Util { 19 | private static String salt = "1qaz2wsx"; 20 | protected static char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', 21 | '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; 22 | 23 | protected static MessageDigest messagedigest = null; 24 | 25 | static { 26 | try { 27 | messagedigest = MessageDigest.getInstance("MD5"); 28 | } catch (NoSuchAlgorithmException nsaex) { 29 | System.err.println(MD5Util.class.getName() 30 | + "初始化失败,MessageDigest不支持MD5Util。"); 31 | nsaex.printStackTrace(); 32 | } 33 | } 34 | 35 | /** 36 | * 功能:加盐版的MD5.返回格式为MD5(密码+{盐值}) 37 | * 38 | * @author 宋立君 39 | * @date 2014年06月24日 40 | * @param password 41 | * 密码 42 | * @param salt 43 | * 盐值 44 | * @return String 45 | */ 46 | public static String getMD5StringWithSalt(String password, String salt) { 47 | if (password == null) { 48 | throw new IllegalArgumentException("password不能为null"); 49 | } 50 | if (StringUtil.isEmpty(salt)) { 51 | throw new IllegalArgumentException("salt不能为空"); 52 | } 53 | if ((salt.toString().lastIndexOf("{") != -1) 54 | || (salt.toString().lastIndexOf("}") != -1)) { 55 | throw new IllegalArgumentException("salt中不能包含 { 或者 }"); 56 | } 57 | return getMD5String(password + "{" + salt.toString() + "}"); 58 | } 59 | 60 | /** 61 | * 功能:得到文件的md5值。 62 | * 63 | * @author 宋立君 64 | * @date 2014年06月24日 65 | * @param file 66 | * 文件。 67 | * @return String 68 | * @throws java.io.IOException 69 | * 读取文件IO异常时。 70 | */ 71 | public static String getFileMD5String(File file) throws IOException { 72 | FileInputStream in = new FileInputStream(file); 73 | FileChannel ch = in.getChannel(); 74 | MappedByteBuffer byteBuffer = ch.map(FileChannel.MapMode.READ_ONLY, 0, 75 | file.length()); 76 | messagedigest.update(byteBuffer); 77 | return bufferToHex(messagedigest.digest()); 78 | } 79 | 80 | /** 81 | * 功能:得到一个字符串的MD5值。 82 | * 83 | * @author 宋立君 84 | * @date 2014年06月24日 85 | * @param str 86 | * 字符串 87 | * @return String 88 | */ 89 | public static String getMD5String(String str) { 90 | return getMD5String(str.getBytes()); 91 | } 92 | 93 | private static String getMD5String(byte[] bytes) { 94 | messagedigest.update(bytes); 95 | return bufferToHex(messagedigest.digest()); 96 | } 97 | 98 | private static String bufferToHex(byte bytes[]) { 99 | return bufferToHex(bytes, 0, bytes.length); 100 | } 101 | 102 | private static String bufferToHex(byte bytes[], int m, int n) { 103 | StringBuffer stringbuffer = new StringBuffer(2 * n); 104 | int k = m + n; 105 | for (int l = m; l < k; l++) { 106 | appendHexPair(bytes[l], stringbuffer); 107 | } 108 | return stringbuffer.toString(); 109 | } 110 | 111 | private static void appendHexPair(byte bt, StringBuffer stringbuffer) { 112 | char c0 = hexDigits[(bt & 0xf0) >> 4]; 113 | char c1 = hexDigits[bt & 0xf]; 114 | stringbuffer.append(c0); 115 | stringbuffer.append(c1); 116 | } 117 | 118 | public static void main(String[] args) { 119 | System.out.println(getMD5String("1qaz2wsxfgzb"));//3161cf25c9cd6d4cc340741e477aa3ef 120 | System.out.println(getMD5StringWithSalt("fgzb","1qaz2wsx"));//31b709bb64897b0d0fa88d37a13ff469 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /src/main/java/com/mybatis/util/MessageSourceHelper.java: -------------------------------------------------------------------------------- 1 | /** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 2 | * ProjectName mybatisdemo1 3 | *  File Name MessageSourceHelper.java  4 | * ** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 5 | *  Copyright (c) 2015 Darlen . All Rights Reserved.  6 | *  注意: 本内容仅限于XXX公司内部使用,禁止转发 7 | * ** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 8 | * */ 9 | package com.mybatis.util; 10 | 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.context.MessageSource; 13 | import org.springframework.context.support.ResourceBundleMessageSource; 14 | import org.springframework.stereotype.Service; 15 | 16 | import java.util.Locale; 17 | 18 | /** 19 | * Description. 国际化信息工具类 20 | * Created on 2015-07-02 上午8:11 21 | * ------------------------------------------------------------------------- 22 | * 版本       修改时间        作者       修改内容  23 | * 1.0.0 上午8:11 Darlen create 24 | * ------------------------------------------------------------------------- 25 | * 26 | * @author Darlen liu 27 | */ 28 | @Service(value = "messageSourceHelper" ) 29 | public class MessageSourceHelper { 30 | @Autowired 31 | private static MessageSource messageSource; 32 | 33 | public void setMessageSource(ResourceBundleMessageSource messageSource) { 34 | MessageSourceHelper.messageSource = messageSource; 35 | } 36 | 37 | public static String getMessage(String code, Object[] args, String defaultMessage, Locale locale) { 38 | String msg = messageSource.getMessage(code, args, defaultMessage, locale); 39 | return msg != null ? msg.trim() : defaultMessage; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/mybatis/util/Pager.java: -------------------------------------------------------------------------------- 1 | package com.mybatis.util; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Description:参考:http://bbs.csdn.net/topics/360010907 User: Darlen liu Date: 7 | * 14-6-24 Time: 下午10:26 8 | */ 9 | public class Pager { 10 | private List list; // 对象记录结果集 11 | private int totalRecode = 0; // 总记录数 12 | private int pageCount = 10; // 每页显示记录数 13 | private int pageRecode = 1; // 总页数 14 | private int curPageNum = 1; // 当前页 15 | 16 | private boolean isFirstPage = false; // 是否为第一页 17 | private boolean isLastPage = false; // 是否为最后一页 18 | private boolean hasPreviousPage = false; // 是否有前一页 19 | private boolean hasNextPage = false; // 是否有下一页 20 | 21 | private int navigatePages = 8; // 导航页码数 22 | private int[] navigatePageNumbers; // 所有导航页号 23 | 24 | public Pager(int totalRecode, int curPageNum) { 25 | init(totalRecode, curPageNum, pageCount); 26 | } 27 | 28 | public Pager(int totalRecode, int curPageNum, int pageCount) { 29 | init(totalRecode, curPageNum, pageCount); 30 | } 31 | 32 | private void init(int totalRecode, int curPageNum, int pageCount) { 33 | // 设置基本参数 34 | this.totalRecode = totalRecode; 35 | this.pageCount = pageCount; 36 | this.pageRecode = (this.totalRecode - 1) / this.pageCount + 1; 37 | 38 | // 根据输入可能错误的当前号码进行自动纠正 39 | if (curPageNum < 1) { 40 | this.curPageNum = 1; 41 | } else if (curPageNum > this.pageRecode) { 42 | this.curPageNum = this.pageRecode; 43 | } else { 44 | this.curPageNum = curPageNum; 45 | } 46 | 47 | // 基本参数设定之后进行导航页面的计算 48 | calcNavigatePageNumbers(); 49 | 50 | // 以及页面边界的判定 51 | judgePageBoudary(); 52 | } 53 | 54 | /** 55 | * 计算导航页 56 | */ 57 | private void calcNavigatePageNumbers() { 58 | // 当总页数小于或等于导航页码数时 59 | if (pageRecode <= navigatePages) { 60 | navigatePageNumbers = new int[pageRecode]; 61 | for (int i = 0; i < pageRecode; i++) { 62 | navigatePageNumbers[i] = i + 1; 63 | } 64 | } else { // 当总页数大于导航页码数时 65 | navigatePageNumbers = new int[navigatePages]; 66 | int startNum = curPageNum - navigatePages / 2; 67 | int endNum = curPageNum + navigatePages / 2; 68 | 69 | if (startNum < 1) { 70 | startNum = 1; 71 | // (最前navigatePages页 72 | for (int i = 0; i < navigatePages; i++) { 73 | navigatePageNumbers[i] = startNum++; 74 | } 75 | } else if (endNum > pageRecode) { 76 | endNum = pageRecode; 77 | // 最后navigatePages页 78 | for (int i = navigatePages - 1; i >= 0; i--) { 79 | navigatePageNumbers[i] = endNum--; 80 | } 81 | } else { 82 | // 所有中间页 83 | for (int i = 0; i < navigatePages; i++) { 84 | navigatePageNumbers[i] = startNum++; 85 | } 86 | } 87 | } 88 | } 89 | 90 | /** 91 | * 判定页面边界 92 | */ 93 | private void judgePageBoudary() { 94 | isFirstPage = curPageNum == 1; 95 | isLastPage = curPageNum == pageRecode && curPageNum != 1; 96 | hasPreviousPage = curPageNum > 1; 97 | hasNextPage = curPageNum < pageRecode; 98 | } 99 | 100 | public void setList(List list) { 101 | this.list = list; 102 | } 103 | 104 | /** 105 | * 得到当前页的内容 106 | * 107 | * @return {List} 108 | */ 109 | public List getList() { 110 | return list; 111 | } 112 | 113 | /** 114 | * 得到记录总数 115 | * 116 | * @return {int} 117 | */ 118 | public int getTotalRecode() { 119 | return totalRecode; 120 | } 121 | 122 | /** 123 | * 得到每页显示多少条记录 124 | * 125 | * @return {int} 126 | */ 127 | public int getPageCount() { 128 | return pageCount; 129 | } 130 | 131 | /** 132 | * 得到页面总数 133 | * 134 | * @return {int} 135 | */ 136 | public int getPageRecode() { 137 | return pageRecode; 138 | } 139 | 140 | /** 141 | * 得到当前页号 142 | * 143 | * @return {int} 144 | */ 145 | public int getCurPageNum() { 146 | return curPageNum; 147 | } 148 | 149 | /** 150 | * 得到所有导航页号 151 | * 152 | * @return {int[]} 153 | */ 154 | public int[] getNavigatePageNumbers() { 155 | return navigatePageNumbers; 156 | } 157 | 158 | public boolean isFirstPage() { 159 | return isFirstPage; 160 | } 161 | 162 | public boolean isLastPage() { 163 | return isLastPage; 164 | } 165 | 166 | public boolean hasPreviousPage() { 167 | return hasPreviousPage; 168 | } 169 | 170 | public boolean hasNextPage() { 171 | return hasNextPage; 172 | } 173 | 174 | public String toString() { 175 | StringBuffer sb = new StringBuffer(); 176 | sb.append("[").append("total=").append(totalRecode).append(",pages=") 177 | .append(pageRecode).append(",pageNumber=").append(curPageNum) 178 | .append(",pageCount=").append(pageCount).append(",isFirstPage=") 179 | .append(isFirstPage).append(",isLastPage=").append(isLastPage) 180 | .append(",hasPreviousPage=").append(hasPreviousPage) 181 | .append(",hasNextPage=").append(hasNextPage) 182 | .append(",navigatePageNumbers="); 183 | int len = navigatePageNumbers.length; 184 | if (len > 0) 185 | sb.append(navigatePageNumbers[0]); 186 | for (int i = 1; i < len; i++) { 187 | sb.append(" " + navigatePageNumbers[i]); 188 | } 189 | sb.append(",list.size=" + list.size()); 190 | sb.append("]"); 191 | return sb.toString(); 192 | } 193 | } 194 | -------------------------------------------------------------------------------- /src/main/resources/com/mybatis/i18n/ssm_en_US.properties: -------------------------------------------------------------------------------- 1 | ###for button 2 | btn.searchBtn=Search 3 | btn.delBtn=Delete 4 | btn.confirmBtn=Confirm 5 | 6 | ###for user table 7 | user.userID=User ID 8 | user.userName=User Name 9 | user.pwd=Password 10 | user.createdDate= Created Date 11 | user.updatedDate=Updated Date 12 | 13 | ###for page widget 14 | page=Page 15 | page.total=Total {0} page, To 16 | page.number=number 17 | page.first=First 18 | page.previous=Previous 19 | page.next=Next 20 | page.last=Last 21 | 22 | ###for message 23 | msg.alertDelUsers=Are you sure want to delete this(these) items? 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/main/resources/com/mybatis/i18n/ssm_zh_CN.properties: -------------------------------------------------------------------------------- 1 | ###for button 2 | btn.searchBtn=\u67e5\u8be2 3 | btn.delBtn=\u5220\u9664 4 | btn.confirmBtn=\u786e\u5b9a 5 | 6 | ###for user table 7 | user.userID=\u7528\u6237ID 8 | user.userName=\u7528\u6237\u540d 9 | user.pwd=\u5bc6\u7801 10 | user.createdDate=\u521b\u5efa\u65f6\u95f4 11 | user.updatedDate=\u66f4\u65b0\u65f6\u95f4 12 | 13 | ###for page widget 14 | page=\u9875 15 | page.total=\u5171{0}\u9875,\u5230\u7b2c 16 | page.number=\u6570\u91cf 17 | page.first=\u9996\u9875 18 | page.previous=\u4e0a\u4e00\u9875 19 | page.next=\u4e0b\u4e00\u9875 20 | page.last=\u5c3e\u9875 21 | 22 | ###for message 23 | msg.alertDelUsers=\u4f60\u786e\u8ba4\u8981\u5220\u9664\u8fd9\uff08\u4e9b\uff09\u5bf9\u8c61\u5417\uff1f -------------------------------------------------------------------------------- /src/main/resources/com/mybatis/mapping/RoleMapper.xml1: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | insert into trole (ID, ROLENAME) 10 | values (#{id,jdbcType=INTEGER}, #{rolename,jdbcType=VARCHAR}) 11 | 12 | 13 | insert into trole 14 | 15 | 16 | ID, 17 | 18 | 19 | ROLENAME, 20 | 21 | 22 | 23 | 24 | #{id,jdbcType=INTEGER}, 25 | 26 | 27 | #{rolename,jdbcType=VARCHAR}, 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/main/resources/com/mybatis/mapping/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 | 20 | 21 | 22 | ID, NAME, PWD, CREATE_TIME, UPDATE_TIME 23 | 24 | 25 | 31 | 32 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 61 | 73 | 74 | 81 | 82 | 83 | 84 | insert into tuser 85 | 86 | ID, 87 | NAME, 88 | PWD, 89 | CREATE_TIME, 90 | UPDATE_TIME, 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | update tuser 103 | 104 | NAME = 105 | PWD = 106 | CREATE_TIME = 107 | UPDATE_TIME = 108 | 109 | where ID = 110 | 111 | 112 | 113 | 121 | 122 | 123 | 124 | 128 | 129 | 130 | 131 | DELETE FROM TUSER WHERE ID IN 132 | 133 | 134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /src/main/resources/com/mybatis/mapping/UserRoleMapper.xml1: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | ID, TUSERID, TROLEID 11 | 12 | 18 | 19 | delete from userrole 20 | where ID = #{id,jdbcType=INTEGER} 21 | 22 | 23 | insert into userrole (ID, TUSERID, TROLEID 24 | ) 25 | values (#{id,jdbcType=INTEGER}, #{tuserid,jdbcType=INTEGER}, #{troleid,jdbcType=INTEGER} 26 | ) 27 | 28 | 29 | insert into userrole 30 | 31 | 32 | ID, 33 | 34 | 35 | TUSERID, 36 | 37 | 38 | TROLEID, 39 | 40 | 41 | 42 | 43 | #{id,jdbcType=INTEGER}, 44 | 45 | 46 | #{tuserid,jdbcType=INTEGER}, 47 | 48 | 49 | #{troleid,jdbcType=INTEGER}, 50 | 51 | 52 | 53 | 54 | update userrole 55 | 56 | 57 | TUSERID = #{tuserid,jdbcType=INTEGER}, 58 | 59 | 60 | TROLEID = #{troleid,jdbcType=INTEGER}, 61 | 62 | 63 | where ID = #{id,jdbcType=INTEGER} 64 | 65 | 66 | update userrole 67 | set TUSERID = #{tuserid,jdbcType=INTEGER}, 68 | TROLEID = #{troleid,jdbcType=INTEGER} 69 | where ID = #{id,jdbcType=INTEGER} 70 | 71 | -------------------------------------------------------------------------------- /src/main/resources/config.properties: -------------------------------------------------------------------------------- 1 | #hibernate.dialect=org.hibernate.dialect.OracleDialect 2 | #driverClassName=oracle.jdbc.driver.OracleDriver 3 | #validationQuery=SELECT 1 FROM DUAL 4 | #jdbc_url=jdbc:oracle:thin:@localhost:1521:orcl 5 | #jdbc_username=sypro 6 | #jdbc_password=sypro 7 | 8 | hibernate.dialect=org.hibernate.dialect.MySQLDialect 9 | driverClassName=com.mysql.jdbc.Driver 10 | validationQuery=SELECT 1 11 | jdbc_url=jdbc:mysql://localhost:3306/mybatisdemo1?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull 12 | jdbc_username=root 13 | jdbc_password=root 14 | 15 | #hibernate.dialect=org.hibernate.dialect.SQLServerDialect 16 | #driverClassName=net.sourceforge.jtds.jdbc.Driver 17 | #validationQuery=SELECT 1 18 | #jdbc_url=jdbc:jtds:sqlserver://127.0.0.1:1433/sy 19 | #jdbc_username=sa 20 | #jdbc_password=123456 21 | 22 | #hibernate.dialect=org.hibernate.dialect.DerbyDialect 23 | #driverClassName=org.apache.derby.jdbc.EmbeddedDriver 24 | #validationQuery=SELECT 1 25 | #jdbc_url=jdbc:derby:sy;create=true 26 | #jdbc_username=sypro 27 | #jdbc_password=sypro 28 | 29 | #jndiName=java:comp/env/dataSourceName 30 | 31 | hibernate.hbm2ddl.auto=update 32 | hibernate.show_sql=false 33 | hibernate.format_sql=true 34 | 35 | sessionInfoName=sessionInfo 36 | 37 | uploadFieldName=filedata 38 | uploadFileMaxSize=20971520 39 | uploadFileExts=txt,rar,zip,doc,docx,xls,xlsx,jpg,jpeg,gif,png,swf,wmv,avi,wma,mp3,mid 40 | uploadDirectory=attached -------------------------------------------------------------------------------- /src/main/resources/log4j.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tree3170/Spring4Mybatis/40f0ced2486170b9300110ba089bca2b5a8d319f/src/main/resources/log4j.properties -------------------------------------------------------------------------------- /src/main/resources/log4j.properties.bak: -------------------------------------------------------------------------------- 1 | 2 | #second method: 3 | log4j.rootLogger=INFO, A1, R 4 | log4j.appender.A1=org.apache.log4j.ConsoleAppender 5 | log4j.appender.A1.layout=org.apache.log4j.PatternLayout 6 | 7 | # Print the date in ISO 8601 format 8 | #log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n 9 | #log4j.appender.A1.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %m%n 10 | log4j.appender.A1.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %l "#" %m%n 11 | log4j.appender.R=org.apache.log4j.RollingFileAppender 12 | log4j.appender.R.File=/elec.log 13 | log4j.appender.R.MaxFileSize=1000KB 14 | log4j.appender.R.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} [%t] [%c] [%p] - %m%n 15 | # Keep one backup file 16 | log4j.appender.R.MaxBackupIndex=10 17 | log4j.appender.R.layout=org.apache.log4j.PatternLayout 18 | #log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n -------------------------------------------------------------------------------- /src/main/resources/log4j.properties.bak2: -------------------------------------------------------------------------------- 1 | ### set log levels ### 2 | #log4j.rootLogger = debug , stdout , D , E 3 | log4j.rootLogger = debug , stdout , D 4 | ### output to the console ### 5 | log4j.appender.stdout = org.apache.log4j.ConsoleAppender 6 | log4j.appender.stdout.Target = System.out 7 | log4j.appender.stdout.layout = org.apache.log4j.PatternLayout 8 | #log4j.appender.stdout.layout.ConversionPattern = %d{ABSOLUTE} %5p %c{ 1 }:%L - %m%n 9 | log4j.appender.stdout.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [%c]-[%p] %m%n 10 | 11 | ### Output to the log file ### 12 | log4j.appender.D = org.apache.log4j.DailyRollingFileAppender 13 | log4j.appender.D.File = ${springmvc.root}/WEB-INF/logs/ssmdemo1.log 14 | log4j.appender.D.Append = true 15 | log4j.appender.D.Threshold = DEBUG 16 | log4j.appender.D.layout = org.apache.log4j.PatternLayout 17 | log4j.appender.D.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n 18 | 19 | ### Save exception information to separate file ### 20 | log4j.appender.D = org.apache.log4j.DailyRollingFileAppender 21 | log4j.appender.D.File = ${springmvc.root}/WEB-INF/logs/ssmdemo1Error.log 22 | log4j.appender.D_File.Append = true 23 | log4j.appender.D.Threshold = ERROR 24 | log4j.appender.D.layout = org.apache.log4j.PatternLayout 25 | log4j.appender.D.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n -------------------------------------------------------------------------------- /src/main/resources/mybatis-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/main/resources/spring-mvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | text/plain;charset=UTF-8 22 | text/html;charset=UTF-8 23 | text/json;charset=UTF-8 24 | application/json;charset=UTF-8 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | UTF-8 44 | 45 | 46 | 32505856 47 | 48 | 49 | 4096 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /src/main/resources/spring-mybatis.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 65 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | com.mybatis.service.* 130 | 131 | 132 | 133 | 136 | 137 | -------------------------------------------------------------------------------- /src/main/resources/spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /src/main/test/TestI18n.java: -------------------------------------------------------------------------------- 1 | /** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 2 | * ProjectName mybatisdemo1 3 | *  File Name TestI18n.java  4 | * ** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 5 | *  Copyright (c) 2015 Darlen . All Rights Reserved.  6 | *  注意: 本内容仅限于XXX公司内部使用,禁止转发 7 | * ** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 8 | * */ 9 | 10 | import org.apache.log4j.Logger; 11 | 12 | import java.util.Locale; 13 | import java.util.ResourceBundle; 14 | 15 | /** 16 | * Description. 17 | * Created on 2015-07-01 下午9:41 18 | * ------------------------------------------------------------------------- 19 | * 版本       修改时间        作者       修改内容  20 | * 1.0.0 下午9:41 Darlen create 21 | * ------------------------------------------------------------------------- 22 | * 23 | * @author Darlen liu 24 | */ 25 | public class TestI18n { 26 | private static Logger logger = Logger.getLogger(TestI18n.class); 27 | //basename 必需是完整的路径 28 | private static String BASENAME = "com.mybatis.i18n.ssm"; 29 | public static void main(String args[]){ 30 | try { 31 | //获取中问环境 32 | Locale locale1 = new Locale("zh", "CN"); 33 | //通过web.xml中的基名信息取得ResourceBundle对象 34 | ResourceBundle resourceBundle1 = ResourceBundle.getBundle(BASENAME, locale1); 35 | //从文件中取得信息 36 | System.out.println("中国大陆环境:"+resourceBundle1.getString("userName")); 37 | //美国 38 | Locale locale2 = new Locale("en", "US"); 39 | ResourceBundle resourceBundle2 = ResourceBundle.getBundle(BASENAME, locale2); 40 | System.out.println("美国环境:"+resourceBundle2.getString("userName")); 41 | //系统默认 42 | ResourceBundle resourceBundle3 = ResourceBundle.getBundle(BASENAME, Locale.getDefault()); 43 | System.out.println("系统默认环境:"+resourceBundle3.getString("userName")); 44 | }catch (Exception e){ 45 | logger.error(e); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/test/TestMybatis.java: -------------------------------------------------------------------------------- 1 | /** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 2 | * ProjectName mybatisdemo1 3 | *  File Name TestMybatis.java  4 | * ** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 5 | *  Copyright (c) 2015 Darlen . All Rights Reserved.  6 | *  注意: 本内容仅限于XXX公司内部使用,禁止转发 7 | * ** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 8 | * */ 9 | 10 | import com.mybatis.model.User; 11 | import com.mybatis.service.UserServiceI; 12 | import org.junit.Before; 13 | import org.junit.Test; 14 | import org.springframework.context.ApplicationContext; 15 | import org.springframework.context.support.ClassPathXmlApplicationContext; 16 | 17 | /** 18 | * Description 这是普通的方法做测试 19 | * Created on 2015-02-03 下午11:31 20 | * ------------------------------------------------------------------------- 21 | * 版本       修改时间        作者       修改内容  22 | * 1.0.0 下午11:31 Darlen create 23 | * ------------------------------------------------------------------------- 24 | * 25 | * @author Darlen liu 26 | */ 27 | public class TestMybatis { 28 | private ApplicationContext ac ; 29 | private UserServiceI userServiceI; 30 | @Before 31 | public void before(){ 32 | ac = new ClassPathXmlApplicationContext( new String[]{"spring.xml","spring-mybatis.xml"}); 33 | userServiceI = (UserServiceI)ac.getBean("userService"); 34 | } 35 | 36 | @Test 37 | public void test1(){ 38 | ApplicationContext ac = new ClassPathXmlApplicationContext( new String[]{"spring.xml","spring-mybatis.xml"}); 39 | UserServiceI userServiceI = (UserServiceI)ac.getBean("userService"); 40 | User user = userServiceI.getUserById(1); 41 | System.out.println(user); 42 | } 43 | 44 | @Test 45 | public void test2(){ 46 | User user = userServiceI.getUserById(1); 47 | System.out.println(user.getName()); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/test/TestSpringMybatis.java: -------------------------------------------------------------------------------- 1 | /** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 2 | * ProjectName mybatisdemo1 3 | *  File Name TestSpringMybatis.java  4 | * ** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 5 | *  Copyright (c) 2015 Darlen . All Rights Reserved.  6 | *  注意: 本内容仅限于XXX公司内部使用,禁止转发 7 | * ** ** ** ** ** ** ** **** ** ** ** ** ** ** **** ** ** ** ** ** ** ** 8 | * */ 9 | 10 | import com.alibaba.fastjson.JSON; 11 | import com.mybatis.model.User; 12 | import com.mybatis.service.UserServiceI; 13 | import com.mybatis.util.DateUtil; 14 | import org.apache.commons.lang.time.DateUtils; 15 | import org.apache.log4j.Logger; 16 | import org.junit.Assert; 17 | import org.junit.Before; 18 | import org.junit.Test; 19 | import org.junit.runner.RunWith; 20 | import org.springframework.beans.factory.annotation.Autowired; 21 | import org.springframework.context.ApplicationContext; 22 | import org.springframework.context.support.ClassPathXmlApplicationContext; 23 | import org.springframework.test.context.ContextConfiguration; 24 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 25 | 26 | import java.sql.Timestamp; 27 | import java.text.SimpleDateFormat; 28 | import java.util.ArrayList; 29 | import java.util.Date; 30 | import java.util.List; 31 | 32 | /** 33 | * Description 这是利用spring test的方法做测试 34 | * 35 | * Created on 2015-02-05 下午10:04 36 | * ------------------------------------------------------------------------- 37 | * 版本       修改时间        作者       修改内容  38 | * 1.0.0 下午10:04 Darlen create 39 | * ------------------------------------------------------------------------- 40 | * 41 | * @author Darlen liu 42 | */ 43 | @RunWith(SpringJUnit4ClassRunner.class) 44 | @ContextConfiguration(locations = {"classpath:spring.xml","classpath:spring-mybatis.xml"}) 45 | public class TestSpringMybatis { 46 | private static final Logger logger = Logger.getLogger(TestSpringMybatis.class); 47 | private UserServiceI userServiceI; 48 | 49 | public UserServiceI getUserServiceI() { 50 | return userServiceI; 51 | } 52 | 53 | @Autowired 54 | public void setUserServiceI(UserServiceI userServiceI) { 55 | this.userServiceI = userServiceI; 56 | } 57 | 58 | @Before 59 | public void before(){ 60 | System.setProperty("springmvc.root","F:\\java_workspace\\ssm\\mybatisdemo1\\src\\main\\webapp"); 61 | } 62 | 63 | 64 | @Test 65 | public void testGetUserByID(){ 66 | User user = userServiceI.getUserById(1); 67 | logger.info(JSON.toJSONString(user)); 68 | logger.info(JSON.toJSONStringWithDateFormat(user,"yyyy-MM-dd HH:mm:ss")); 69 | } 70 | 71 | @Test 72 | public void testGetUserByName(){ 73 | User user = userServiceI.getUserByName("test1"); 74 | logger.info(JSON.toJSONStringWithDateFormat(user,"yyyy-MM-dd HH:mm:ss")); 75 | } 76 | 77 | @Test 78 | public void testGetAllUser(){ 79 | try { 80 | List userList = userServiceI.getAllUser(); 81 | logger.info("============="+JSON.toJSONStringWithDateFormat(userList,"yyyy-MM-dd HH:mm:ss")); 82 | logger.error("#############"+userList.size()); 83 | logger.info("############"+ System.getProperty("springmvc.root")); 84 | // logger.info("############"+ System.getProperty("log4j.appender.Error_File.File")); 85 | }catch (Exception e){ 86 | logger.info("############"); 87 | //logger.info("############"+ System.getProperty("log4j.appender.Error_File.File")); 88 | logger.error(e); 89 | } 90 | } 91 | 92 | @Test 93 | public void testInsertUser(){ 94 | int count = 0; 95 | User user = new User(); 96 | try { 97 | // for(int i =40;i<41;i++){ 98 | user.setName("testinsert"+41); 99 | user.setPwd("123"); 100 | // user.setCreateTime(DateUtil.getCurDate(DateUtil.DEFAULT_DATETIME_FORMAT_SEC)); 101 | logger.info("######DATETIME:"+new Date().getTime()); 102 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 103 | user.setUpdateTime(sdf.format(new Date()));//new Timestamp(new Date().getTime()) 104 | count = userServiceI.insertUser(user); 105 | // } 106 | 107 | // Assert.assertEquals("########not the expect result",1,count); 108 | }catch (Exception e){ 109 | // Assert.assertEquals("########not the expect result",1,count); 110 | logger.info("############"); 111 | //logger.info("############"+ System.getProperty("log4j.appender.Error_File.File")); 112 | logger.error(e); 113 | } 114 | logger.info("#############count:"+count); 115 | 116 | } 117 | 118 | @Test 119 | public void testUpdateUser() throws Exception { 120 | User user = userServiceI.getUserByName("testinsert40"); 121 | user.setPwd("125"); 122 | //user.setCreateTime(new java.sql.Date(new Date().getTime())); 123 | user.setCreateTime(new java.sql.Date(new Date().getTime())); 124 | // user.setUpdateTime(DateUtil.getCurDate(DateUtil.DEFAULT_DATETIME_FORMAT_SEC)); 125 | // user.setUpdateTime(new Timestamp(newUserRoleMapper Date().getTime())); 126 | //updatetime 是string类型,mybatis配置文件不配类型,这样可以解决丢失时分秒的问题 127 | user.setUpdateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); 128 | int num = userServiceI.updByUserID(user); 129 | logger.info("###########num="+num); 130 | } 131 | 132 | @Test 133 | public void testDelUser(){ 134 | User user = userServiceI.getUserByName("testinsert"); 135 | logger.info("============="+JSON.toJSONStringWithDateFormat(user,"yyyy-MM-dd HH:mm:ss")); 136 | int num = userServiceI.delUserByID(user.getId()); 137 | logger.info("###########num="+num); 138 | } 139 | 140 | @Test 141 | public void testBatchDelUsers(){ 142 | List ids = new ArrayList(); 143 | ids.add("7"); 144 | ids.add("8"); 145 | int num = userServiceI.batchDelUserByIDs(ids); 146 | logger.info("###########num="+num); 147 | // int num = userServiceI.delUserByID(user.getId()); 148 | // logger.info("###########num="+num); 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/errorPage/404.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | css3立体效果404页面 - 建站特效http://51xuediannao.com 6 | 7 | 8 | 9 | 10 | 78 | 79 | 80 | 81 | 82 |

83 |
404
84 |
85 | 该页面不存在(´・ω・`)
86 | 懒人建站 http://www.51xuediannao.com 整理 87 |
88 |
89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/errorPage/404.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 |

404page1

4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/errorPage/405.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 |

405page

4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/errorPage/500.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 |

500page

4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/errorPage/mantaince.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 网页短时间维护倒计时js代码 - 懒人建站-jquery特效-建站素材 http:/www.51xuediannao.com/ 6 | 22 | 23 | 24 | 25 | 26 |
27 |
28 |
29 |

懒人建站正在维护中...

30 |

将给您带来全新的体验

31 |

敬请期待

32 |
33 |
34 | : 35 |
36 |
37 |
38 | 58 |

懒人建站-jquery特效-建站素材

59 | 60 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/finalExample.jsp: -------------------------------------------------------------------------------- 1 | <%@ page import="javax.servlet.jsp.jstl.core.Config" %> 2 | <%@ page import="java.util.Locale" %> 3 | <%-- 4 | Desc: 完整bootstrap模式页面、mybatis分页功能、restful的spring mvc功能,将尽可能含括表单的 5 | 所有操作的很多功能,抽出去公共JS API,同时包含增删改查的所有功能。 6 | User: Darlen liu 7 | Date: 15-6-27 下午12:43 8 | --%> 9 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 10 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 11 | <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 12 | <% 13 | //session.setAttribute("javax.servlet.jsp.jstl.fmt.localizationContext.session",Locale.US); 14 | // session.setAttribute("WW_TRANS_I18N_LOCALE", Locale.CHINA); 15 | //response.setLocale(Locale.CHINESE); 16 | String path = request.getContextPath(); 17 | String bathPath = request.getScheme() + "://" + request.getServerName() + ":" + request 18 | .getServerPort() + path + "/"; 19 | %> 20 | 21 | 22 | 23 | 24 | 最终样例 25 | 26 | 27 | 28 | 29 | 30 | 48 | 49 | 50 | 51 | <%----%> 52 |

最终bootstrap之table布局

53 |
54 | 55 | 62 |
63 | 67 | 68 | en 69 | | 70 | zh 71 | 72 | 73 |
74 | 75 |
76 | " id="sehBtn"> 77 | " id="delBtn"> 78 |
79 |
80 | 81 | 82 |
83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 |
TanmayBangalore560001Bangalore560001
TanmayBangalore560001Bangalore560001
TanmayBangalore560001Bangalore560001
120 |
121 | 122 | 123 |
124 |
125 | 126 | 127 | 128 | " class="btn btn-xs btn-primary"> 129 |
130 | 131 | 142 |
143 |
144 | 145 | 146 | 147 | 148 | 168 | 169 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/testExceptionHandlerDemo.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <% 3 | //session.setAttribute("javax.servlet.jsp.jstl.fmt.localizationContext.session",Locale.US); 4 | // session.setAttribute("WW_TRANS_I18N_LOCALE", Locale.CHINA); 5 | //response.setLocale(Locale.CHINESE); 6 | String path = request.getContextPath(); 7 | String bathPath = request.getScheme() + "://" + request.getServerName() + ":" + request 8 | .getServerPort() + path + "/"; 9 | 10 | %> 11 | 12 | 13 | 14 | 15 | 16 | 17 | css3立体效果404页面 - 建站特效http://51xuediannao.com 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 | ${exception} 32 | 33 | 34 |
35 | 测试exceptionHandler : 10/1
36 | 测试exceptionHandler : 10/0 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | mybatis 8 | 9 | 10 | 11 | contextConfigLocation 12 | classpath:spring.xml,classpath:spring-mybatis.xml 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | webAppRootKey 23 | myWebApp.root 24 | 25 | 26 | 27 | 28 | log4jConfigLocation 29 | classpath:log4j.properties 30 | 31 | 32 | 34 | log4jRefreshInterval 35 | 6000 36 | 37 | 38 | 39 | 40 | javax.servlet.jsp.jstl.fmt.localizationContext 41 | 42 | com.mybatis.i18n.ssm 43 | 44 | 45 | 46 | 47 | Log4jInitServlet 48 | com.mybatis.servlet.Log4jInitServlet 49 | 50 | log4jInit 51 | WEB-INF\classes\log4j.properties 52 | 53 | 1 54 | 55 | 56 | 57 | 61 | 62 | Log4jConfigListener 63 | org.springframework.web.util.Log4jConfigListener 64 | 65 | 66 | 67 | 68 | 字符集过滤器 69 | encodingFilter 70 | org.springframework.web.filter.CharacterEncodingFilter 71 | 72 | 字符集编码 73 | encoding 74 | UTF-8 75 | 76 | 77 | forceEncoding 78 | true 79 | 80 | 81 | 82 | encodingFilter 83 | /* 84 | 85 | 86 | 87 | 88 | spring监听器 89 | org.springframework.web.context.ContextLoaderListener 90 | 91 | 92 | 93 | 94 | org.springframework.web.util.IntrospectorCleanupListener 95 | 96 | 97 | 98 | 99 | spring mvc servlet 100 | springMvc 101 | org.springframework.web.servlet.DispatcherServlet 102 | 103 | spring mvc 配置文件 104 | contextConfigLocation 105 | classpath:spring-mvc.xml 106 | 107 | 1 108 | 109 | 110 | springMvc 111 | / 112 | 113 | 114 | 123 | 124 | 125 | 126 | 127 | 128 | 404 129 | /WEB-INF/errorPage/404.html 130 | 131 | 132 | 133 | 405 134 | /WEB-INF/errorPage/405.jsp 135 | 136 | 137 | 138 | 500 139 | /WEB-INF/errorPage/500.jsp 140 | 141 | 142 | 143 | javax.servlet.ServletException 144 | /WEB-INF/errorPage/error.html 145 | 146 | 147 | java.lang.NullPointerException 148 | /WEB-INF/errorPage/error.html 149 | 150 | 151 | /index.jsp 152 | 153 | 154 | 155 | 156 | 30 157 | 158 | -------------------------------------------------------------------------------- /src/main/webapp/fenYeDemo.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | User: Darlen liu 3 | Date: 15-6-22 下午2:40 4 | Function: 这是一个关于mybatis的分页demo 5 | --%> 6 | <%@ page import="com.mybatis.service.UserServiceI" %> 7 | <%@ page import="com.mybatis.service.UserServiceImpl" %> 8 | <%@ page import="com.mybatis.model.User" %> 9 | <%@ page import="com.alibaba.fastjson.JSON" %> 10 | <%@ page import="java.util.Date" %> 11 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 12 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 13 | <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 14 | <%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> 15 | <% 16 | String path = request.getContextPath(); 17 | String bathPath = request.getScheme() + "://" + request.getServerName() + ":" + request 18 | .getServerPort() + path + "/"; 19 | %> 20 | 21 | 22 | 23 | Mybatis分页插件 - 测试页面 24 | 90 | 91 | 92 | 93 | 218 | 219 | 220 | 221 | 222 | 223 | 260 | 261 |
262 |
263 | 264 |

查询用户列表

265 |
266 | 267 |

查询用户列表

268 |
269 | 270 | 271 |

${errorMsg}

272 |
273 |
274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 |
页码:页面大小:"/>"/>
284 |
285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 |
分页信息
当前页号${page.pageNum}页面大小${page.pageSize}
起始行号(>)${page.startRow}终止行号(<=)${page.endRow}
总结果数${page.total}总页数${page.pages}
第一页${page.firstPage}前一页${page.prePage}
下一页${page.nextPage}最后一页${page.lastPage}
是否为第一页${page.isFirstPage}是否为最后一页${page.isLastPage}
是否有前一页${page.hasPreviousPage}是否有下一页${page.hasNextPage}
333 |
334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 |
查询结果
ID用户名用户密码创建时间更新时间操作
${user.id}${user.name}${user.pwd}${user.createTime}${user.updateTime}查询删除
369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 |
首页前一页${nav}${nav}下一页最后一页
393 |
394 |
395 |
396 |
397 |
398 |
399 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | -------------------------------------------------------------------------------- /src/main/webapp/finalModal.html: -------------------------------------------------------------------------------- 1 | 6 | 16 | 17 | 26 | 27 | 40 | 41 | -------------------------------------------------------------------------------- /src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <% 3 | String path = request.getContextPath(); 4 | String basePath = request.getScheme() + "://" 5 | + request.getServerName() + ":" + request.getServerPort() 6 | + path ; 7 | %> 8 | 9 | 10 | 11 | 12 | 13 | 14 | Uikit Test 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
26 |

Uikit Test

27 |
28 |
29 |
30 | Uikit表单渲染测试 31 |
32 | 33 |
34 |
35 | 36 |
37 |
38 | 39 |
40 |
41 | 42 |
43 |
44 | 49 |
50 |
51 | 52 |
53 |
54 |
55 | 基于Restful架构风格的资源请求测试 56 | 57 | 58 | 59 | 60 | 61 |
62 |
63 | 64 | 65 | 66 | 67 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /src/main/webapp/jqGridDemo.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <% 3 | String path = request.getContextPath(); 4 | String basePath = request.getScheme() + "://" 5 | + request.getServerName() + ":" + request.getServerPort() 6 | + path ; 7 | %> 8 | 9 | 10 | 11 | 12 | 13 | 14 | jdGrid Test 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 |
27 | 28 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /src/main/webapp/mvcSample.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | User: Darlen liu 3 | Date: 15-6-11 下午9:40 4 | Function: ThiS is a Frond-End Sample JSP for Spring MVC 5 | 这是一个SpringMVC前台的小例子,后期会不断完善,争取包括所有的可能性。 6 | 简单表单(inputbox,dropdown,checkbox,radiobutton,file,textare...) 7 | Add,delete,update,search,分页 8 | pdf,excel,download 9 | --%> 10 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 11 | <% 12 | String path = request.getContextPath(); 13 | String bathPath = request.getScheme() + "://" + request.getServerName() + ":" + request 14 | .getServerPort() + path + "/"; 15 | %> 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 35 | 36 | 51 | 52 | 53 |

Spring MVC Frond End Demo


54 |
55 |

Show All Users

56 |
57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 |
用户名密码ID创建时间更新时间
IDuserNamepwdCreated DateUpdated Date
76 | 77 |
78 |
79 | 80 | 81 |
82 |

Search User

83 |
84 |
85 | 86 | 87 |
88 | 89 |
90 |
91 |

92 | 93 |
94 |

Insert User

95 | 96 |
97 |
98 | 99 | 100 | 101 | 102 | 105 | 106 | 107 | 108 | 111 | 112 | 113 |
103 | 104 |
109 | 110 |
114 |
115 | 116 |
117 |
118 |

119 | 120 |
121 |

Update User

122 | 123 |
124 |
125 | 126 | 127 | 128 | 129 | 133 | 134 | 135 |
130 | 131 | + 132 |
136 |
137 |
138 | 139 |
140 | 141 |
142 |

Delete User

143 | 144 |
145 |
146 | 147 | 148 | 149 | 153 | 154 |
150 | 151 | + 152 |
155 |
156 |
157 | 158 |
159 | 160 |
161 |

Batch Delete Users by ids

162 | 163 |
164 |
165 | 166 | 167 | 168 | 172 | 173 |
169 | 170 | + 171 |
174 |
175 |
176 | 177 |
178 | 179 |

180 | 181 |
182 |

Upload Image

183 | 184 |
186 | 187 | 188 |
189 |
190 |
191 | 192 | 193 | 194 | -------------------------------------------------------------------------------- /src/main/webapp/showUser.jsp: -------------------------------------------------------------------------------- 1 | <%@ page import="com.alibaba.fastjson.JSON" %> 2 | <%@ page import="java.util.ArrayList" %> 3 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 4 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 5 | 6 | 7 | 8 | 9 | Show User 10 | 11 | 12 | 13 | userName:${user.name} 14 |
<%=JSON.toJSONString(request.getAttribute("user"))%> 15 | <%=JSON.toJSONStringWithDateFormat(request.getAttribute("user"),"yyyy-MM-dd HH:mm:ss")%> 16 | 17 |
20 | -------------------------------------------------------------------------------- /src/main/webapp/userModal.html: -------------------------------------------------------------------------------- 1 | 6 | 16 | 25 | 38 | -------------------------------------------------------------------------------- /src/main/webapp/vender/bootstrap-3.3.5/css/bootstrap-theme.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.3.5 (http://getbootstrap.com) 3 | * Copyright 2011-2015 Twitter, Inc. 4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 5 | */.btn-danger,.btn-default,.btn-info,.btn-primary,.btn-success,.btn-warning{text-shadow:0 -1px 0 rgba(0,0,0,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075)}.btn-danger.active,.btn-danger:active,.btn-default.active,.btn-default:active,.btn-info.active,.btn-info:active,.btn-primary.active,.btn-primary:active,.btn-success.active,.btn-success:active,.btn-warning.active,.btn-warning:active{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-danger.disabled,.btn-danger[disabled],.btn-default.disabled,.btn-default[disabled],.btn-info.disabled,.btn-info[disabled],.btn-primary.disabled,.btn-primary[disabled],.btn-success.disabled,.btn-success[disabled],.btn-warning.disabled,.btn-warning[disabled],fieldset[disabled] .btn-danger,fieldset[disabled] .btn-default,fieldset[disabled] .btn-info,fieldset[disabled] .btn-primary,fieldset[disabled] .btn-success,fieldset[disabled] .btn-warning{-webkit-box-shadow:none;box-shadow:none}.btn-danger .badge,.btn-default .badge,.btn-info .badge,.btn-primary .badge,.btn-success .badge,.btn-warning .badge{text-shadow:none}.btn.active,.btn:active{background-image:none}.btn-default{text-shadow:0 1px 0 #fff;background-image:-webkit-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-o-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#e0e0e0));background-image:linear-gradient(to bottom,#fff 0,#e0e0e0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#dbdbdb;border-color:#ccc}.btn-default:focus,.btn-default:hover{background-color:#e0e0e0;background-position:0 -15px}.btn-default.active,.btn-default:active{background-color:#e0e0e0;border-color:#dbdbdb}.btn-default.disabled,.btn-default.disabled.active,.btn-default.disabled.focus,.btn-default.disabled:active,.btn-default.disabled:focus,.btn-default.disabled:hover,.btn-default[disabled],.btn-default[disabled].active,.btn-default[disabled].focus,.btn-default[disabled]:active,.btn-default[disabled]:focus,.btn-default[disabled]:hover,fieldset[disabled] .btn-default,fieldset[disabled] .btn-default.active,fieldset[disabled] .btn-default.focus,fieldset[disabled] .btn-default:active,fieldset[disabled] .btn-default:focus,fieldset[disabled] .btn-default:hover{background-color:#e0e0e0;background-image:none}.btn-primary{background-image:-webkit-linear-gradient(top,#337ab7 0,#265a88 100%);background-image:-o-linear-gradient(top,#337ab7 0,#265a88 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#265a88));background-image:linear-gradient(to bottom,#337ab7 0,#265a88 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff265a88', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#245580}.btn-primary:focus,.btn-primary:hover{background-color:#265a88;background-position:0 -15px}.btn-primary.active,.btn-primary:active{background-color:#265a88;border-color:#245580}.btn-primary.disabled,.btn-primary.disabled.active,.btn-primary.disabled.focus,.btn-primary.disabled:active,.btn-primary.disabled:focus,.btn-primary.disabled:hover,.btn-primary[disabled],.btn-primary[disabled].active,.btn-primary[disabled].focus,.btn-primary[disabled]:active,.btn-primary[disabled]:focus,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary,fieldset[disabled] .btn-primary.active,fieldset[disabled] .btn-primary.focus,fieldset[disabled] .btn-primary:active,fieldset[disabled] .btn-primary:focus,fieldset[disabled] .btn-primary:hover{background-color:#265a88;background-image:none}.btn-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#419641));background-image:linear-gradient(to bottom,#5cb85c 0,#419641 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#3e8f3e}.btn-success:focus,.btn-success:hover{background-color:#419641;background-position:0 -15px}.btn-success.active,.btn-success:active{background-color:#419641;border-color:#3e8f3e}.btn-success.disabled,.btn-success.disabled.active,.btn-success.disabled.focus,.btn-success.disabled:active,.btn-success.disabled:focus,.btn-success.disabled:hover,.btn-success[disabled],.btn-success[disabled].active,.btn-success[disabled].focus,.btn-success[disabled]:active,.btn-success[disabled]:focus,.btn-success[disabled]:hover,fieldset[disabled] .btn-success,fieldset[disabled] .btn-success.active,fieldset[disabled] .btn-success.focus,fieldset[disabled] .btn-success:active,fieldset[disabled] .btn-success:focus,fieldset[disabled] .btn-success:hover{background-color:#419641;background-image:none}.btn-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#2aabd2));background-image:linear-gradient(to bottom,#5bc0de 0,#2aabd2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#28a4c9}.btn-info:focus,.btn-info:hover{background-color:#2aabd2;background-position:0 -15px}.btn-info.active,.btn-info:active{background-color:#2aabd2;border-color:#28a4c9}.btn-info.disabled,.btn-info.disabled.active,.btn-info.disabled.focus,.btn-info.disabled:active,.btn-info.disabled:focus,.btn-info.disabled:hover,.btn-info[disabled],.btn-info[disabled].active,.btn-info[disabled].focus,.btn-info[disabled]:active,.btn-info[disabled]:focus,.btn-info[disabled]:hover,fieldset[disabled] .btn-info,fieldset[disabled] .btn-info.active,fieldset[disabled] .btn-info.focus,fieldset[disabled] .btn-info:active,fieldset[disabled] .btn-info:focus,fieldset[disabled] .btn-info:hover{background-color:#2aabd2;background-image:none}.btn-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#eb9316));background-image:linear-gradient(to bottom,#f0ad4e 0,#eb9316 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#e38d13}.btn-warning:focus,.btn-warning:hover{background-color:#eb9316;background-position:0 -15px}.btn-warning.active,.btn-warning:active{background-color:#eb9316;border-color:#e38d13}.btn-warning.disabled,.btn-warning.disabled.active,.btn-warning.disabled.focus,.btn-warning.disabled:active,.btn-warning.disabled:focus,.btn-warning.disabled:hover,.btn-warning[disabled],.btn-warning[disabled].active,.btn-warning[disabled].focus,.btn-warning[disabled]:active,.btn-warning[disabled]:focus,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning,fieldset[disabled] .btn-warning.active,fieldset[disabled] .btn-warning.focus,fieldset[disabled] .btn-warning:active,fieldset[disabled] .btn-warning:focus,fieldset[disabled] .btn-warning:hover{background-color:#eb9316;background-image:none}.btn-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c12e2a));background-image:linear-gradient(to bottom,#d9534f 0,#c12e2a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#b92c28}.btn-danger:focus,.btn-danger:hover{background-color:#c12e2a;background-position:0 -15px}.btn-danger.active,.btn-danger:active{background-color:#c12e2a;border-color:#b92c28}.btn-danger.disabled,.btn-danger.disabled.active,.btn-danger.disabled.focus,.btn-danger.disabled:active,.btn-danger.disabled:focus,.btn-danger.disabled:hover,.btn-danger[disabled],.btn-danger[disabled].active,.btn-danger[disabled].focus,.btn-danger[disabled]:active,.btn-danger[disabled]:focus,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger,fieldset[disabled] .btn-danger.active,fieldset[disabled] .btn-danger.focus,fieldset[disabled] .btn-danger:active,fieldset[disabled] .btn-danger:focus,fieldset[disabled] .btn-danger:hover{background-color:#c12e2a;background-image:none}.img-thumbnail,.thumbnail{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{background-color:#e8e8e8;background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{background-color:#2e6da4;background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}.navbar-default{background-image:-webkit-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-o-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#f8f8f8));background-image:linear-gradient(to bottom,#fff 0,#f8f8f8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075)}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.open>a{background-image:-webkit-linear-gradient(top,#dbdbdb 0,#e2e2e2 100%);background-image:-o-linear-gradient(top,#dbdbdb 0,#e2e2e2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dbdbdb),to(#e2e2e2));background-image:linear-gradient(to bottom,#dbdbdb 0,#e2e2e2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.075);box-shadow:inset 0 3px 9px rgba(0,0,0,.075)}.navbar-brand,.navbar-nav>li>a{text-shadow:0 1px 0 rgba(255,255,255,.25)}.navbar-inverse{background-image:-webkit-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-o-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#3c3c3c),to(#222));background-image:linear-gradient(to bottom,#3c3c3c 0,#222 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-radius:4px}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.open>a{background-image:-webkit-linear-gradient(top,#080808 0,#0f0f0f 100%);background-image:-o-linear-gradient(top,#080808 0,#0f0f0f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#080808),to(#0f0f0f));background-image:linear-gradient(to bottom,#080808 0,#0f0f0f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.25);box-shadow:inset 0 3px 9px rgba(0,0,0,.25)}.navbar-inverse .navbar-brand,.navbar-inverse .navbar-nav>li>a{text-shadow:0 -1px 0 rgba(0,0,0,.25)}.navbar-fixed-bottom,.navbar-fixed-top,.navbar-static-top{border-radius:0}@media (max-width:767px){.navbar .navbar-nav .open .dropdown-menu>.active>a,.navbar .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar .navbar-nav .open .dropdown-menu>.active>a:hover{color:#fff;background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}}.alert{text-shadow:0 1px 0 rgba(255,255,255,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05)}.alert-success{background-image:-webkit-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#c8e5bc));background-image:linear-gradient(to bottom,#dff0d8 0,#c8e5bc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);background-repeat:repeat-x;border-color:#b2dba1}.alert-info{background-image:-webkit-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#b9def0));background-image:linear-gradient(to bottom,#d9edf7 0,#b9def0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);background-repeat:repeat-x;border-color:#9acfea}.alert-warning{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#f8efc0));background-image:linear-gradient(to bottom,#fcf8e3 0,#f8efc0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);background-repeat:repeat-x;border-color:#f5e79e}.alert-danger{background-image:-webkit-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-o-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#e7c3c3));background-image:linear-gradient(to bottom,#f2dede 0,#e7c3c3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);background-repeat:repeat-x;border-color:#dca7a7}.progress{background-image:-webkit-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#ebebeb),to(#f5f5f5));background-image:linear-gradient(to bottom,#ebebeb 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x}.progress-bar{background-image:-webkit-linear-gradient(top,#337ab7 0,#286090 100%);background-image:-o-linear-gradient(top,#337ab7 0,#286090 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#286090));background-image:linear-gradient(to bottom,#337ab7 0,#286090 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff286090', GradientType=0);background-repeat:repeat-x}.progress-bar-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#449d44));background-image:linear-gradient(to bottom,#5cb85c 0,#449d44 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);background-repeat:repeat-x}.progress-bar-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#31b0d5));background-image:linear-gradient(to bottom,#5bc0de 0,#31b0d5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);background-repeat:repeat-x}.progress-bar-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#ec971f));background-image:linear-gradient(to bottom,#f0ad4e 0,#ec971f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);background-repeat:repeat-x}.progress-bar-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c9302c));background-image:linear-gradient(to bottom,#d9534f 0,#c9302c 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);background-repeat:repeat-x}.progress-bar-striped{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.list-group{border-radius:4px;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.list-group-item.active,.list-group-item.active:focus,.list-group-item.active:hover{text-shadow:0 -1px 0 #286090;background-image:-webkit-linear-gradient(top,#337ab7 0,#2b669a 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2b669a 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2b669a));background-image:linear-gradient(to bottom,#337ab7 0,#2b669a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2b669a', GradientType=0);background-repeat:repeat-x;border-color:#2b669a}.list-group-item.active .badge,.list-group-item.active:focus .badge,.list-group-item.active:hover .badge{text-shadow:none}.panel{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.05);box-shadow:0 1px 2px rgba(0,0,0,.05)}.panel-default>.panel-heading{background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.panel-primary>.panel-heading{background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}.panel-success>.panel-heading{background-image:-webkit-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#d0e9c6));background-image:linear-gradient(to bottom,#dff0d8 0,#d0e9c6 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);background-repeat:repeat-x}.panel-info>.panel-heading{background-image:-webkit-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#c4e3f3));background-image:linear-gradient(to bottom,#d9edf7 0,#c4e3f3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);background-repeat:repeat-x}.panel-warning>.panel-heading{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#faf2cc));background-image:linear-gradient(to bottom,#fcf8e3 0,#faf2cc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);background-repeat:repeat-x}.panel-danger>.panel-heading{background-image:-webkit-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-o-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#ebcccc));background-image:linear-gradient(to bottom,#f2dede 0,#ebcccc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);background-repeat:repeat-x}.well{background-image:-webkit-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#e8e8e8),to(#f5f5f5));background-image:linear-gradient(to bottom,#e8e8e8 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x;border-color:#dcdcdc;-webkit-box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1)} -------------------------------------------------------------------------------- /src/main/webapp/vender/bootstrap-3.3.5/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /src/main/webapp/vender/jqgrid4.8.2/css/ui.jqgrid.css: -------------------------------------------------------------------------------- 1 | /*Grid*/ 2 | .ui-jqgrid {position: relative;-moz-box-sizing: content-box; -webkit-box-sizing: content-box; box-sizing: content-box;} 3 | .ui-jqgrid .ui-jqgrid-view {position: relative;left:0; top: 0; padding: 0; font-size:11px;} 4 | /* caption*/ 5 | .ui-jqgrid .ui-jqgrid-titlebar {height:19px; padding: .3em .2em .2em .3em; position: relative; font-size: 12px; border-left: 0 none;border-right: 0 none; border-top: 0 none;} 6 | .ui-jqgrid .ui-jqgrid-caption {text-align: left;} 7 | .ui-jqgrid .ui-jqgrid-title { margin: .1em 0 .2em; } 8 | .ui-jqgrid .ui-jqgrid-titlebar-close { position: absolute;top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height:18px; cursor:pointer;} 9 | .ui-jqgrid .ui-jqgrid-titlebar-close span { display: block; margin: 1px; } 10 | .ui-jqgrid .ui-jqgrid-titlebar-close:hover { padding: 0; } 11 | /* header*/ 12 | .ui-jqgrid .ui-jqgrid-hdiv {position: relative; margin: 0;padding: 0; overflow: hidden; border-left: 0 none !important; border-top : 0 none !important; border-right : 0 none !important;} 13 | .ui-jqgrid .ui-jqgrid-hbox {float: left; padding-right: 20px;} 14 | .ui-jqgrid .ui-jqgrid-htable {table-layout:fixed;margin:0;border-collapse: separate;} 15 | .ui-jqgrid .ui-jqgrid-htable th { height: 27px; padding: 0 2px 0 2px;} 16 | .ui-jqgrid .ui-jqgrid-htable th div {overflow: hidden; position:relative; height:auto;margin: .1em 0em;} 17 | .ui-th-column, .ui-jqgrid .ui-jqgrid-htable th.ui-th-column {overflow: hidden;white-space: nowrap;text-align:center;border-top : 0 none;border-bottom : 0 none;} 18 | .ui-th-column-header, .ui-jqgrid .ui-jqgrid-htable th.ui-th-column-header {overflow: hidden;white-space: nowrap;text-align:center;border-top : 0 none; height: 26px;} 19 | .ui-th-ltr, .ui-jqgrid .ui-jqgrid-htable th.ui-th-ltr {border-left : 0 none;} 20 | .ui-th-rtl, .ui-jqgrid .ui-jqgrid-htable th.ui-th-rtl {border-right : 0 none;} 21 | .ui-first-th-ltr {border-right: 1px solid; } 22 | .ui-first-th-rtl {border-left: 1px solid; } 23 | .ui-jqgrid .ui-th-div-ie {white-space: nowrap; zoom :1; height:17px;} 24 | .ui-jqgrid .ui-jqgrid-resize {height:20px !important;position: relative; cursor :e-resize;display: inline;overflow: hidden;} 25 | .ui-jqgrid .ui-grid-ico-sort {overflow:hidden;position:absolute;display:inline; cursor: pointer !important;} 26 | .ui-jqgrid .ui-icon-asc {margin-top:-3px; height:12px;} 27 | .ui-jqgrid .ui-icon-desc {margin-top:3px;height:12px;} 28 | .ui-jqgrid .ui-i-asc {margin-top:0;height:16px;} 29 | .ui-jqgrid .ui-i-desc {margin-top:0;margin-left:13px;height:16px;} 30 | .ui-jqgrid .ui-jqgrid-sortable {cursor:pointer;} 31 | .ui-jqgrid tr.ui-search-toolbar th { } 32 | .ui-jqgrid .ui-search-table td.ui-search-clear { width:25px;} 33 | .ui-jqgrid tr.ui-search-toolbar td > input { padding-right: 0px;} 34 | .ui-jqgrid tr.ui-search-toolbar select {} 35 | /* body */ 36 | .ui-jqgrid .ui-jqgrid-bdiv {position: relative; margin: 0; padding:0; overflow: auto; text-align:left;} 37 | .ui-jqgrid .ui-jqgrid-btable {table-layout:fixed; margin:0; outline-style: none; border-collapse: separate;} 38 | .ui-jqgrid tr.jqgrow { outline-style: none; } 39 | .ui-jqgrid tr.jqgroup { outline-style: none; } 40 | .ui-jqgrid tr.jqgrow td {font-weight: normal; overflow: hidden; white-space: pre; height: 23px;padding: 1px 2px 1px 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;} 41 | .ui-jqgrid tr.jqgfirstrow td {padding: 0 2px 0 2px;border-right-width: 1px; border-right-style: solid;} 42 | .ui-jqgrid tr.jqgroup td {font-weight: normal; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;} 43 | .ui-jqgrid tr.jqfoot td {font-weight: bold; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;} 44 | .ui-jqgrid tr.ui-row-ltr td {text-align:left;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;} 45 | .ui-jqgrid tr.ui-row-rtl td {text-align:right;border-left-width: 1px; border-left-color: inherit; border-left-style: solid;} 46 | .ui-jqgrid td.jqgrid-rownum { padding: 0 2px 0 2px; margin: 0; border: 0 none;} 47 | .ui-jqgrid .ui-jqgrid-resize-mark { width:2px; left:0; background-color:#777; cursor: e-resize; cursor: col-resize; position:absolute; top:0; height:100px; overflow:hidden; display:none; border:0 none; z-index: 99999;} 48 | /* footer */ 49 | .ui-jqgrid .ui-jqgrid-sdiv {position: relative; margin: 0;padding: 0; overflow: hidden; border-left: 0 none !important; border-top : 0 none !important; border-right : 0 none !important;} 50 | .ui-jqgrid .ui-jqgrid-ftable {table-layout:fixed; margin-bottom:0;border-collapse: separate;} 51 | .ui-jqgrid tr.footrow td {font-weight: bold; overflow: hidden; white-space:nowrap; height: 20px;padding: 0 2px 0 2px;border-top-width: 1px; border-top-color: inherit; border-top-style: solid;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;} 52 | .ui-jqgrid tr.footrow-ltr td {text-align:left;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;} 53 | .ui-jqgrid tr.footrow-rtl td {text-align:right;border-left-width: 1px; border-left-color: inherit; border-left-style: solid;} 54 | /* Pager*/ 55 | .ui-jqgrid .ui-jqgrid-pager { border-left: 0 none !important;border-right: 0 none !important; border-bottom: 0 none !important; border-top: 0 none; margin: 0 !important; padding: 0 !important; position: relative; height: auto; min-height: 28px; white-space: nowrap;overflow: hidden;font-size:11px;} 56 | .ui-jqgrid .ui-jqgrid-toppager .ui-pager-control, .ui-jqgrid .ui-jqgrid-pager .ui-pager-control {position: relative;border-left: 0;border-bottom: 0;border-top: 0; height: 28px;} 57 | .ui-jqgrid .ui-pg-table {position: relative; padding: 1px 0; width:auto; margin: 0;} 58 | .ui-jqgrid .ui-pg-table td {font-weight:normal; vertical-align:middle; padding:0px 1px;} 59 | .ui-jqgrid .ui-pg-button { height:auto} 60 | .ui-jqgrid .ui-pg-button span { display: block; margin: 2px; float:left;} 61 | .ui-jqgrid .ui-pg-button:hover { padding: 0; } 62 | .ui-jqgrid .ui-state-disabled:hover {padding:1px;} 63 | .ui-jqgrid .ui-pg-input,.ui-jqgrid .ui-jqgrid-toppager .ui-pg-input { height:14px;width: auto;font-size:.9em; margin:0;line-height: inherit;border: none; padding: 3px 2px} 64 | .ui-jqgrid .ui-pg-selbox, .ui-jqgrid .ui-jqgrid-toppager .ui-pg-selbox {font-size:.9em; line-height:inherit; display:block; height:19px; margin: 0; padding: 3px 0px; border:none;} 65 | .ui-jqgrid .ui-separator {height: 18px; border-left: 1px solid #ccc ; border-right: 1px solid #ccc ; margin: 1px; float: right;} 66 | .ui-jqgrid .ui-paging-info {font-weight: normal;height:auto; margin-top:3px;margin-right:4px;display: inline;} 67 | .ui-jqgrid .ui-jqgrid-pager .ui-pg-div {padding:1px 0;float:left;position:relative; line-height: 20px;} 68 | .ui-jqgrid .ui-jqgrid-pager .ui-pg-button { cursor:pointer; } 69 | .ui-jqgrid .ui-jqgrid-pager .ui-pg-div span.ui-icon {float:left;margin: 2px; width:18px;} 70 | .ui-jqgrid td input, .ui-jqgrid td select, .ui-jqgrid td textarea { margin: 0;} 71 | .ui-jqgrid td textarea {width:auto;height:auto;} 72 | .ui-jqgrid .ui-jqgrid-toppager {border-left: 0 none !important;border-right: 0 none !important; border-top: 0 none !important; margin: 0 !important; padding: 0 !important; position: relative; height: 25px !important;white-space: nowrap;overflow: hidden;} 73 | .ui-jqgrid .ui-jqgrid-toppager .ui-pg-div {padding:1px 0;float:left;position:relative; line-height: 20px;} 74 | .ui-jqgrid .ui-jqgrid-toppager .ui-pg-button { cursor:pointer; } 75 | .ui-jqgrid .ui-jqgrid-toppager .ui-pg-div span.ui-icon {float:left;margin: 2px; width:18px;} 76 | /*subgrid*/ 77 | .ui-jqgrid .ui-jqgrid-btable .ui-sgcollapsed span {display: block;} 78 | .ui-jqgrid .ui-subgrid {margin:0;padding:0; width:100%;} 79 | .ui-jqgrid .ui-subgrid table {table-layout: fixed;} 80 | .ui-jqgrid .ui-subgrid tr.ui-subtblcell td {height:18px;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;} 81 | .ui-jqgrid .ui-subgrid td.subgrid-data {border-top: 0 none !important;} 82 | .ui-jqgrid .ui-subgrid td.subgrid-cell {border-width: 0 0 1px 0;} 83 | .ui-jqgrid .ui-th-subgrid {height:20px;} 84 | /* loading */ 85 | .ui-jqgrid .loading {position: absolute; top: 45%;left: 45%;width: auto;z-index:101;padding: 6px; margin: 5px;text-align: center;font-weight: bold;display: none;border-width: 2px !important; font-size:11px;} 86 | .ui-jqgrid .jqgrid-overlay {display:none;z-index:100;} 87 | /* IE * html .jqgrid-overlay {width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');} */ 88 | * .jqgrid-overlay iframe {position:absolute;top:0;left:0;z-index:-1;} 89 | /* IE width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}*/ 90 | /* end loading div */ 91 | /* toolbar */ 92 | .ui-jqgrid .ui-userdata {border-left: 0 none; border-right: 0 none; height : 21px;overflow: hidden; } 93 | /*Modal Window */ 94 | .ui-jqgrid .ui-jqdialog { font-size:11px; } 95 | .ui-jqdialog { display: none; width: 300px; position: absolute; padding: .2em; font-size:11px; overflow:visible;} 96 | .ui-jqdialog .ui-jqdialog-titlebar { padding: .3em .2em; position: relative; height:20px;} 97 | .ui-jqdialog .ui-jqdialog-title { margin: .3em 0 .2em; } 98 | .ui-jqdialog .ui-jqdialog-titlebar-close { position: absolute; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; cursor:pointer;} 99 | 100 | .ui-jqdialog .ui-jqdialog-titlebar-close span { display: block; margin: 1px; } 101 | .ui-jqdialog .ui-jqdialog-titlebar-close:hover, .ui-jqdialog .ui-jqdialog-titlebar-close:focus { padding: 0; } 102 | .ui-jqdialog-content, .ui-jqdialog .ui-jqdialog-content { border: 0; padding: .3em .2em; background: none; height:auto;} 103 | .ui-jqdialog .ui-jqconfirm {padding: .4em 1em; border-width:3px;position:absolute;bottom:10px;right:10px;overflow:visible;display:none;height:80px;width:220px;text-align:center;} 104 | .ui-jqdialog>.ui-resizable-se { bottom: -3px; right: -3px} 105 | .ui-jqgrid>.ui-resizable-se { bottom: -3px; right: -3px } 106 | /* end Modal window*/ 107 | /* Form edit */ 108 | .ui-jqdialog-content .FormGrid {margin: 0;} 109 | .ui-jqdialog-content .EditTable { width: 100%; margin-bottom:0;} 110 | .ui-jqdialog-content .DelTable { width: 100%; margin-bottom:0;} 111 | .EditTable td input, .EditTable td select, .EditTable td textarea {margin: 0;} 112 | .EditTable td textarea { width:auto; height:auto;} 113 | .ui-jqdialog-content td.EditButton {text-align: right;border-top: 0 none;border-left: 0 none;border-right: 0 none; padding-bottom:5px; padding-top:5px;} 114 | .ui-jqdialog-content td.navButton {text-align: center; border-left: 0 none;border-top: 0 none;border-right: 0 none; padding-bottom:5px; padding-top:5px;} 115 | .ui-jqdialog-content input.FormElement {padding: .5em .3em; margin-bottom: 3px} 116 | .ui-jqdialog-content select.FormElement {padding:.3em; margin-bottom: 3px;} 117 | .ui-jqdialog-content .data-line {padding-top:.1em;border: 0 none;} 118 | 119 | .ui-jqdialog-content .CaptionTD {vertical-align: middle;border: 0 none; padding: 2px;white-space: nowrap;} 120 | .ui-jqdialog-content .DataTD {padding: 2px; border: 0 none; vertical-align: top;} 121 | .ui-jqdialog-content .form-view-data {white-space:pre} 122 | .fm-button { height: 18px; display: inline-block; margin:2px 4px 0 0; padding: .6em .5em .2em .5em; text-decoration:none !important; cursor:pointer; position: relative; text-align: center; zoom: 1; } 123 | .fm-button-icon-left { padding-left: 1.9em; } 124 | .fm-button-icon-right { padding-right: 1.9em; } 125 | .fm-button-icon-left .ui-icon { right: auto; left: .2em; margin-left: 0; position: absolute; top: 50%; margin-top: -8px; } 126 | .fm-button-icon-right .ui-icon { left: auto; right: .2em; margin-left: 0; position: absolute; top: 50%; margin-top: -8px;} 127 | #nData, #pData { float: left; margin:3px;padding: 0; width: 15px; } 128 | /* End Eorm edit */ 129 | /*.ui-jqgrid .edit-cell {}*/ 130 | .ui-jqgrid .selected-row, div.ui-jqgrid .selected-row td {font-style : normal;border-left: 0 none;} 131 | /* inline edit actions button*/ 132 | .ui-inline-del.ui-state-hover span, .ui-inline-edit.ui-state-hover span, 133 | .ui-inline-save.ui-state-hover span, .ui-inline-cancel.ui-state-hover span { 134 | margin: -1px; 135 | } 136 | /* Tree Grid */ 137 | .ui-jqgrid .tree-wrap {float: left; position: relative;height: 18px;white-space: nowrap;overflow: hidden;} 138 | .ui-jqgrid .tree-minus {position: absolute; height: 18px; width: 18px; overflow: hidden;} 139 | .ui-jqgrid .tree-plus {position: absolute; height: 18px; width: 18px; overflow: hidden;} 140 | .ui-jqgrid .tree-leaf {position: absolute; height: 18px; width: 18px;overflow: hidden;} 141 | .ui-jqgrid .treeclick {cursor: pointer;} 142 | /* moda dialog */ 143 | * iframe.jqm {position:absolute;top:0;left:0;z-index:-1;} 144 | /* width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}*/ 145 | .ui-jqgrid-dnd tr td {border-right-width: 1px; border-right-color: inherit; border-right-style: solid; height:20px} 146 | /* RTL Support */ 147 | .ui-jqgrid .ui-jqgrid-caption-rtl {text-align: right;} 148 | .ui-jqgrid .ui-jqgrid-hbox-rtl {float: right; padding-left: 20px;} 149 | .ui-jqgrid .ui-jqgrid-resize-ltr {float: right;margin: -2px -2px -2px 0;} 150 | .ui-jqgrid .ui-jqgrid-resize-rtl {float: left;margin: -2px 0 -1px -3px;} 151 | .ui-jqgrid .ui-sort-rtl {left:0;} 152 | .ui-jqgrid .tree-wrap-ltr {float: left;} 153 | .ui-jqgrid .tree-wrap-rtl {float: right;} 154 | .ui-jqgrid .ui-ellipsis {-moz-text-overflow:ellipsis;text-overflow:ellipsis;} 155 | 156 | /* Toolbar Search Menu */ 157 | .ui-search-menu { position: absolute; padding: 2px 5px;} 158 | .ui-search-menu.ui-menu .ui-menu-item { list-style-image: none; padding-right: 0; padding-left: 0; } 159 | .ui-search-menu.ui-menu .ui-menu-item a { display: block; } 160 | .ui-search-menu.ui-menu .ui-menu-item a.g-menu-item:hover { margin: -1px; font-weight: normal; } 161 | .ui-jqgrid .ui-search-table { padding: 0; border: 0 none; height:20px; width:100%;} 162 | .ui-jqgrid .ui-search-table .ui-search-oper { width:20px; } 163 | a.g-menu-item, a.soptclass, a.clearsearchclass { cursor: pointer; } 164 | .ui-jqgrid .ui-jqgrid-view input, 165 | .ui-jqgrid .ui-jqgrid-view select, 166 | .ui-jqgrid .ui-jqgrid-view textarea, 167 | .ui-jqgrid .ui-jqgrid-view button { 168 | font-size: 11px 169 | } 170 | .ui-jqgrid .ui-scroll-popup {width: 95px;} 171 | .ui-search-table select, 172 | .ui-search-table input 173 | { 174 | padding: 4px 3px; 175 | } 176 | --------------------------------------------------------------------------------