admin9527's recent timeline updates
admin9527

admin9527

V2EX member #219180, joined on 2017-03-06 13:25:52 +08:00
admin9527's recent replies
@cs4814751 恩,是的,没注意,原来都是用在 ajax 表单提交上的
@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
dateFormat.setLenient(false);

SimpleDateFormat datetimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
datetimeFormat.setLenient(false);

binder.registerCustomEditor(java.util.Date.class, new CustomDateEditor(dateFormat, true));
binder.registerCustomEditor(java.sql.Timestamp.class,new CustomDateEditor(datetimeFormat, true));
}
可以在控制 controller 上加注解,注入的时候应该就会自动转了,不过想想直接用 string 接收方便多了。
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5699 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 17ms · UTC 03:22 · PVG 11:22 · LAX 20:22 · JFK 23:22
♥ Do have faith in what you're doing.