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"/>

 这样就是现了string-->date类型的转换

SpringMVC报错The request sent by the client was syntactically incorrect ()的更多相关文章

  1. Spring MVC报错:The request sent by the client was syntactically incorrect ()

    原因: 1.参数名称不一致 2.参数类型不一致

  2. spring mvc 在上传图片时,浏览器报The request sent by the client was syntactically incorrect

    项目中,在一个jsp页面里其它图片上传是功能是可以使用的,当我自己新加了一个图片上传时,提交表单后,浏览器报The request sent by the client was syntactical ...

  3. 错误:The request sent by the client was syntactically incorrect的解决

    问题: 错误400-The request sent by the client was syntactically incorrect. springMVC中,某个页面提交时报400错误,如下图. ...

  4. SpringMVC---400错误The request sent by the client was syntactically incorrect ()

    在SpringMVC中使用@RequestBody和@ModelAttribute注解时遇到了很多问题,现记录下来. @ModelAttribute这个注解主要是将客户端请求的参数绑定参数到一个对象上 ...

  5. 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 ...

  6. 又见The request sent by the client was syntactically incorrect ()

    前几天遇到过这个问题(Ref:http://www.cnblogs.com/xiandedanteng/p/4168609.html),问题在页面的组件name和和注解的@param名匹配不对,这个好 ...

  7. "The request sent by the client was syntactically incorrect ()"问题定位及解决:

    Spring MVC "The request sent by the client was syntactically incorrect ()"解决办法: 把spring日志级 ...

  8. The request sent by the client was syntactically incorrect问题解决

    The request sent by the client was syntactically incorrect意思嘛,google翻译一下 通过日志不难看出,是由参数不匹配造成的. 所以对于Da ...

  9. 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 ...

随机推荐

  1. UIAlertController 的使用

    IAlertController 同时替代了 UIAlertView 和 UIActionSheet,从系统层级上统一了 alert 的概念 —— 即以 modal 方式或 popover 方式展示. ...

  2. C#编程利器之一:类(Class)【转】

    C#编程利器之一:类(Class) 面向对象的程序设计(Object-Oriented Programming,简记为OOP)是一种功能非常强大的编程方法,立意于创建软件重用代码,以类为基础去思考编程 ...

  3. C# 消息队列

    阅读目录 1. 消息队列是什么? 2. 常见的消息队列框架有哪些? 3. MSMQ介绍 4. RabbitMQ介绍 消息队列是什么 简单的理解就是将消息添加一个队列中,使用时在从这个队列中取出来.那么 ...

  4. php基础篇-二维数组排序 array_multisort

    原文:php基础篇-二维数组排序 array_multisort 对2维数组或者多维数组排序是常见的问题,在php中我们有个专门的多维数组排序函数,下面简单介绍下: array_multisort(a ...

  5. mysql qps tps计算

    Information from web QPS (Query per second) (每秒查询量)TPS(Transaction per second) (每秒事务量,如果是InnoDB会显示,没 ...

  6. PRML读书笔记——Mathematical notation

    x, a vector, and all vectors are assumed to be column vectors. M, denote matrices. xT, a row vcetor, ...

  7. box-flex不均分问题

    解决box-flex不均等分的问题 我想当你上手css3的时候后一定为他的强大而感到震惊,但是震惊之后带来的一定是苦恼,因为他太TM变态了! 我之所以这么说是因为我今天写box-flex的时候遇到了一 ...

  8. windows系统调用 semaphore信号量

    #include "iostream" #include "windows.h" #include "cstring" using name ...

  9. ExtJs Grid 删除,编辑,查看详细等超链接处理

    在网上查了好多资料,关于ExtJs处理操作栏的“删除”.“编辑”.“查看详细”的处理,原来项目都是这么处理: 操作栏:{ text:'操作', xtype:'actioncolumn', items ...

  10. REPL LOG

    using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressi ...