This file contains 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
あってるかどうか知らん | |
stackoverflow かどこかで見つけたやつ? | |
空欄のときに validation をスキップさせたい時に使った。 | |
@InitBinder | |
public void initBinder(WebDataBinder binder) { | |
// 入力値が空の場合は null をセットしてバリデータをスキップする | |
binder.registerCustomEditor(String.class, "field_name", new StringTrimmerEditor(true)); | |
} |
This file contains 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
JSP/JSTL (よくまとまってる) | |
http://struts.wasureppoi.com/jstl/00_jstl.html | |
Spring Framework (ver4) | |
https://docs.spring.io/spring/docs/4.3.13.RELEASE/spring-framework-reference/htmlsingle/ | |
Spring Security | |
https://docs.spring.io/spring-security/site/docs/4.2.3.RELEASE/reference/htmlsingle/ | |
Validator 関連 |
This file contains 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
// 日付欄に空白を許可 | |
// https://stackoverflow.com/questions/4806033/converting-empty-string-to-null-date-object-with-spring | |
@InitBinder | |
public void initBinder(WebDataBinder binder) { | |
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); | |
dateFormat.setLenient(false); | |
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); | |
} |
NewerOlder