首页>代码>SSM+jQuery EasyUI后台管理系统>/sypro/src/sy/controller/BaseController.java
package sy.controller;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;

import sy.util.CustomDateEditor;

/**   
*    
* 项目名称:sypro   
* 类名称:BaseController   
* 类描述: 基础控制器,其他控制器需extends此控制器获得initBinder自动转换的功能  
* 创建人:君无邪   
* 创建时间:2015年11月15日 下午4:58:21   
* 修改备注:  https://www.java214.com 
* @version    1.0
*    
*/ 
@Controller
@RequestMapping("/baseController")
public class BaseController {

	private static final Logger logger = Logger.getLogger(BaseController.class);

	/**
	 * 将前台传递过来的日期格式的字符串,自动转化为Date类型
	 * 
	 * @param binder
	 * 
	 */
	@InitBinder
	public void initBinder(ServletRequestDataBinder binder) {
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		// dateFormat.setLenient(false);
		binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
		// binder.registerCustomEditor(String.class, new StringTrimmerEditor(false));
	}

}
最近下载更多
13645180698  LV5 5月12日
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日
最近浏览更多
13645180698  LV5 5月12日
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日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友