springMVC日期转换及The request sent by the client was syntactically incorrect.解决办法
来源:互联网 发布:java中权限控制框架 编辑:程序博客网 时间:2024/06/05 05:04
今天在前端通过日期插件查询时出现错误:
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.
- HDU 1166 敌兵布阵(线段树单点更新)
- 多平台轻量级消息推送系统msgd
- pfring 调研+总结
- spring框架学习(四)自动装配
- PHP获取微信粉丝的OpenID
- springMVC日期转换及The request sent by the client was syntactically incorrect.解决办法
- webdriver-超时与等待
- 简单编程题目连载(八)——最短路径问题
- 关于easyUI删除表格中的行后,提示删除成功并重新加载表格的方法
- Android程序员学PHP开发(13)-简易计算器-PhpStorm
- String...和String[]区别
- 数据库对象命名参考
- zoj1163
- Android StringUtils