Created
April 7, 2014 08:58
-
-
Save yanhua365/10016938 to your computer and use it in GitHub Desktop.
在Spring MVC的Controller里注册日期参数的转换器
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @InitBinder | |
| protected void initBinder(HttpServletRequest request, | |
| ServletRequestDataBinder binder) { | |
| SimpleDateFormat dateFormat = | |
| new SimpleDateFormat("yyyy-MM-dd"); | |
| dateFormat.setLenient(false); | |
| binder.registerCustomEditor(Date.class, null, | |
| new CustomDateEditor(dateFormat, true)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment