SpringMVC.xml里添加:
<mvc:annotation-driven ></mvc:annotation-driven>
@DateTimeFormat(pattern="yyyy-MM-dd") //时间格式化
private Date birth;
`@NumberFormat(pattern="#,###,###.#")//数字格式化格式
private Float salary;`
这样简单的注解就可以搞定从前台传过来的数据
本文介绍如何使用SpringMVC中的注解实现日期和数字格式化功能,通过简单的配置即可轻松处理从前端传递来的数据。
SpringMVC.xml里添加:
<mvc:annotation-driven ></mvc:annotation-driven>
@DateTimeFormat(pattern="yyyy-MM-dd") //时间格式化
private Date birth;
`@NumberFormat(pattern="#,###,###.#")//数字格式化格式
private Float salary;`
这样简单的注解就可以搞定从前台传过来的数据
2071
1170

被折叠的 条评论
为什么被折叠?