SpringMVC报错The request sent by the client was syntactically incorrect ()
springmvc数据绑定出的错
在数据绑定的时候一定要主意Controller方法中的参数名和jsp页面里的参数名字是否一致或者按照绑定的规范来写,
如果不一致,可能回报如下错误:
The request sent by the client was syntactically incorrect ().
从字面上理解是:客户端发送的请求语法错误。
实际就是springmvc无法实现数据绑定。
查看一下你传的参数是不是有date类型等Springmvc不支持参数绑定的类型,需自己绑定
date时间类型绑定 String-->date
String--> date 时间格式
package com.online.util; import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale; import org.springframework.format.Formatter; public class DateFormatter implements Formatter<Date>{ public String print(Date object, Locale locale) {
return null;
} public Date parse(String text, Locale locale) throws ParseException {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = null;
try {
date = format.parse(text);
} catch (Exception e) {
format = new SimpleDateFormat("yyyy-MM-dd");
date = format.parse(text);
}
return date;
}
}
在Spring的applicationContext.xml中注入这个类
<!-- 时间类型转换 -->
<bean id="conversionService"
class="org.springframework.format.support.FormattingConversionServiceFactoryBean">
<property name="formatters">
<set>
<bean class="com.online.util.DateFormatter"></bean>
</set>
</property>
</bean>
在Springmvc.xml中使用 mvc:annotation-driven注解配置
<mvc:annotation-driven conversion-service="conversionService"/>
SpringMVC报错The request sent by the client was syntactically incorrect ()的更多相关文章
- Spring MVC报错:The request sent by the client was syntactically incorrect ()
原因: 1.参数名称不一致 2.参数类型不一致
- spring mvc 在上传图片时,浏览器报The request sent by the client was syntactically incorrect
项目中,在一个jsp页面里其它图片上传是功能是可以使用的,当我自己新加了一个图片上传时,提交表单后,浏览器报The request sent by the client was syntactical ...
- 错误:The request sent by the client was syntactically incorrect的解决
问题: 错误400-The request sent by the client was syntactically incorrect. springMVC中,某个页面提交时报400错误,如下图. ...
- SpringMVC---400错误The request sent by the client was syntactically incorrect ()
在SpringMVC中使用@RequestBody和@ModelAttribute注解时遇到了很多问题,现记录下来. @ModelAttribute这个注解主要是将客户端请求的参数绑定参数到一个对象上 ...
- The request sent by the client was syntactically incorrect.
HTTP Status 400 - type Status report message description The request sent by the client was syntacti ...
- 又见The request sent by the client was syntactically incorrect ()
前几天遇到过这个问题(Ref:http://www.cnblogs.com/xiandedanteng/p/4168609.html),问题在页面的组件name和和注解的@param名匹配不对,这个好 ...
- "The request sent by the client was syntactically incorrect ()"问题定位及解决:
Spring MVC "The request sent by the client was syntactically incorrect ()"解决办法: 把spring日志级 ...
- The request sent by the client was syntactically incorrect问题解决
The request sent by the client was syntactically incorrect意思嘛,google翻译一下 通过日志不难看出,是由参数不匹配造成的. 所以对于Da ...
- HTTP Status 400 - description The request sent by the client was syntactically incorrect.
HTTP Status 400 - type Status report message description The request sent by the client was syntacti ...
随机推荐
- alloc
注意,凡是用到指针的地方,一定要在堆中分配空间,否则指针释放了,那就不能够传值了. 将一个对象作为另外一个对象的成员变量,可以直接将两个对象联系起来.
- ant build utf-8
使用Ant编译过程中,报error: unmappable character for encoding UTF8 最简单的方法是在Build.xml文件中,在所有出现Javac的地方,增加一个选项: ...
- Fiddler-009-AutoResponder 简单的 MOCK SERVER 应用实例
在我们日常的测试中经常需要测试特定的响应对应的客户端展示样式是否正确无误,实现测试方法一般有如下三种: 创建新的测试数据(工作量较大) 修改已有测试数据(例如修改对应的状态码,若是最终需要测试的按钮状 ...
- linux环境下配置java WEB项目运行环境,jdk8+tomcat8+mysql5.7.11 新手向
一:安装jdk 1.下载jdk 在oracle下载东西的时候因为oracle的一些验证机制,所以需要在链接前面添加一些参数 wget --no-check-certificate --no-cook ...
- (地址)eclipse插件开发攻略的访问地址
园子地址: http://www.cnblogs.com/liuzhuo/category/257208.html 关键字: Eclipse插件开发彻底攻略 eclipse插件开发基础篇之
- 由FutureTask的get方法靠什么机制来阻塞引发的思考
1. FutureTask的get方法靠什么机制来阻塞 看其get方法源码: /** * @throws CancellationException {@inheritDoc} */ public V ...
- 如何学习Python
[整理]如何学习Python + 如何有效利用Python有关的网络资源 + 如何利用Python自带手册(Python Manual) http://www.crifan.com/howto_lea ...
- Linux操作系统备份之一:使用LVM快照实现Linux操作系统数据的在线备份
这里我们讨论Linux操作系统的备份. 在生产环境,客户都会要求做全系统的数据备份,用于系统崩溃后的一种恢复手段.这其中就包含操作系统数据的备份恢复. 由于是生产环境,客户都会要求备份不中断业务,也就 ...
- gulp详细入门教程(转载)
本文转载自: gulp详细入门教程
- HTML5 Web Storage
Web Storage是HTML5 API提供一个新的重要的特性: 最新的Web Storage草案中提到,在web客户端可用html5 API,以Key-Value形式来进行数据持久存储: 目前主要 ...