html 变量类型强制转换,html、js前台数据传到后台,spring复杂类型转换
html、js前臺數據傳到后臺,spring復雜類型轉換
如果我有兩個變量,變量名不一樣,處理的規則也不一樣,但是他們都是Date.class 類型, 這可怎么破。比如:
@InitBinder
public?void?bindingPreparation(WebDataBinder?binder)?{
DateFormat?dateFormat1?=?new?SimpleDateFormat("d-MM-yyyy");
CustomDateEditor?orderDateEditor?=?new?CustomDateEditor(dateFormat1,?true);
DateFormat?dateFormat2?=?new?SimpleDateFormat("MMM?d,?YYYY");
CustomDateEditor?shipDateEditor?=?new?CustomDateEditor(dateFormat2,?true);
binder.registerCustomEditor(Date.class,?"orderDate",?orderDateEditor);
binder.registerCustomEditor(Date.class,?"shipDate",?shipDateEditor);
}
spring中有很多種propertyEditor
總結
以上是生活随笔為你收集整理的html 变量类型强制转换,html、js前台数据传到后台,spring复杂类型转换的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: css设置 ul的内外边距,9月3日学习
- 下一篇: ecshop适应在php7,ecshop