springMVC日期转换及The request sent by the client was syntactically incorrect.解决办法
来源:互联网 发布:戴维宁在二端口能用么 编辑:程序博客网 时间:2024/05/18 03:37
今天在前端通过日期插件查询时出现错误:
springMVC参数错误。细查之后原来是因为前端传过去的是String类型,而接受数据的类型为Date类型,这时有2中解决办法:
一、日期格式转换:
通过SimpleDateFormat.parse(“”)把参数格式化为Date类型。
二、通过springMVC.xml配置日期转换。
在springMVC的xml配置文件中添加如下代码:
<mvc:annotation-driven conversion-service="conversionService" /> <bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean"> <property name="registerDefaultFormatters" value="true" /> <property name="formatterRegistrars"> <set> <bean class="org.springframework.format.datetime.DateFormatterRegistrar"> <property name="formatter" ref="dateFormatter"></property> </bean> </set> </property> </bean> <bean id="dateFormatter" class="org.springframework.format.datetime.DateFormatter"> <property name="pattern" value="yyyy-MM-dd"></property> </bean>
0 0
- springMVC日期转换及The request sent by the client was syntactically incorrect.解决办法
- springMVC日期转换及The request sent by the client was syntactically incorrect.解决办法
- The request sent by the client was syntactically incorrect ()"解决办法
- The request sent by the client was syntactically incorrect解决办法
- SpringMVC 出现"The request sent by the client was syntactically incorrect ()"解决办法
- The request sent by the client was syntactically incorrect.
- The request sent by the client was syntactically incorrect.
- The request sent by the client was syntactically incorrect问题解决
- The request sent by the client was syntactically incorrect
- The request sent by the client was syntactically incorrect ()问题
- The request sent by the client was syntactically incorrect.
- The request sent by the client was syntactically incorrect
- The request sent by the client was syntactically incorrect.
- The request sent by the client was syntactically incorrect
- The request sent by the client was syntactically incorrect ()解决方法
- The request sent by the client was syntactically incorrect.
- The request sent by the client was syntactically incorrect ()
- The request sent by the client was syntactically incorrect.
- C++-继承:基类与派生类对象的关系&&继承与组合
- hello world
- 简学Python第三章__函数式编程、递归、内置函数
- 使用bmob后端云中listview如何实现数据显示在第一个item
- scala内置函数
- springMVC日期转换及The request sent by the client was syntactically incorrect.解决办法
- ubantu和Windows双系统在ubantu中设置默认启动系统
- django-url常见用法
- IOS开发学习笔记(五)
- Stanford Parser使用
- 源码安装nagios-4.2 (centos 6.8)
- springMVC前台时间字符串到后台Date的转换
- 446. Arithmetic Slices II
- Android RecyclerView设计通用Adapter