首页>代码>SSM+jQuery EasyUI后台管理系统>/sypro/src/sy/controller/BaseController.java
01package sy.controller;
02 
03import java.text.SimpleDateFormat;
04import java.util.Date;
05 
06import org.apache.log4j.Logger;
07import org.springframework.stereotype.Controller;
08import org.springframework.web.bind.ServletRequestDataBinder;
09import org.springframework.web.bind.annotation.InitBinder;
10import org.springframework.web.bind.annotation.RequestMapping;
11 
12import sy.util.CustomDateEditor;
13 
14/**  
15*   
16* 项目名称:sypro  
17* 类名称:BaseController  
18* 类描述: 基础控制器,其他控制器需extends此控制器获得initBinder自动转换的功能 
19* 创建人:君无邪  
20* 创建时间:2015年11月15日 下午4:58:21  
21* 修改备注:  https://www.java214.com
22* @version    1.0
23*   
24*/
25@Controller
26@RequestMapping("/baseController")
27public class BaseController {
28 
29    private static final Logger logger = Logger.getLogger(BaseController.class);
30 
31    /**
32     * 将前台传递过来的日期格式的字符串,自动转化为Date类型
33     *
34     * @param binder
35     *
36     */
37    @InitBinder
38    public void initBinder(ServletRequestDataBinder binder) {
39        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
40        // dateFormat.setLenient(false);
41        binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
42        // binder.registerCustomEditor(String.class, new StringTrimmerEditor(false));
43    }
44 
45}
最近下载更多
erqiu2013  LV18 2023年12月27日
张朕朕  LV3 2023年9月1日
王国平  LV7 2022年9月12日
137455054  LV9 2022年5月13日
myfz0662  LV10 2022年3月23日
幸运疯子  LV13 2021年12月16日
刘亦菲9527  LV15 2021年12月1日
zql666  LV9 2021年9月26日
zhoulang123  LV8 2021年9月4日
anzai123  LV3 2021年8月20日
最近浏览更多
qiheideguang  LV18 2024年12月4日
bluerstar  LV1 2024年10月23日
zhengguangshun  LV4 2024年8月25日
chn-lei  LV2 2024年7月31日
gaowang  LV1 2024年5月29日
poilkj1313  LV1 2024年5月10日
zpppppppppppppppppp 2024年4月20日
暂无贡献等级
1303891  LV1 2024年4月14日
123dwda 2024年3月17日
暂无贡献等级
aachl1  LV5 2024年1月16日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友