`

The request sent by the client was syntactically incorrect错误原因

 
阅读更多

Spring MVC架构的应用。

springmvc数据绑定是一个很好的东西,在数据绑定的时候一定要主意Controller方法中的参数名和jsp页面里的参数名字是否一致或者按照绑定的规范来写,如果不一致,可能回报如下错误:
The request sent by the client was syntactically incorrect ().从字面上理解是:客户端发送的请求语法错误。实际就是springmvc无法实现数据绑定。

1、Ajax提交时没有反应。

提交方法:

$.ajax({

type : "post",

url : "${ctx}/channelrecord/saveWebPage",

data : $("form").serialize(),

async : false,

success : function(data) {

 

}

});

经验证,提交方式没有任何问题,却在提交时无反应。

 

2、查看响应。

查看提交后的响应正文,如下:

<html>

<head>

<title>Apache Tomcat/7.0.53 - Error report</title>

<style>

<!--

H1 {

font-family: Tahoma, Arial, sans-serif;

color: white;

background-color: #525D76;

font- size: 22px;

}

 

H2 {

font-family: Tahoma, Arial, sans-serif;

color: white;

background- color: #525D76;

font-size: 16px;

}

 

H3 {

font-family: Tahoma, Arial, sans- serif;

color: white;

background-color: #525D76;

font-size: 14px;

}

 

BODY {

font- family: Tahoma, Arial, sans-serif;

color: black;

background-color: white;

}

 

B {

font- family: Tahoma, Arial, sans-serif;

color: white;

background-color: #525D76;

}

 

P {

font- family: Tahoma, Arial, sans-serif;

background: white;

color: black;

font-size: 12px;

}

 

A {

color: black;

}

 

A.name {

color: black;

}

 

HR {

color: #525D76;

}

-->

</style>

</head>

<body>

<h1>HTTP Status 400 -</h1>

<HR size="1" noshade="noshade">

<p>

<b>type</b> Status report

</p>

<p>

<b>message</b> <u></u>

</p>

<p>

<b>description</b> <u>The request sent by the client was

syntactically incorrect.</u>

</p>

<HR size="1" noshade="noshade">

<h3>Apache Tomcat/7.0.53</h3>

</body>

</html>

 

其中,The request sent by the client was syntactically incorrect 告诉我们,请求不正确。

 

3、从网上其他地方找到的错误原因:

若有日期、时间字段提交,则需要规范日期、时间的格式,否则无法转换。

4、在Action/Controller中添加 如下方法,即可规范所有的格式。

@InitBinder

    public void initBinder(WebDataBinder binder) {

        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        dateFormat.setLenient(false);

        binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));

    }

 

 

问题解决

分享到:
评论

相关推荐

    servlet2.4doc

    The doFilter method of the Filter is called by the container each time a request/response pair is passed through the chain due to a client request for a resource at the end of the chain. doGet...

    SSD7 选择题。Multiple-Choice

    (b) the name of the table, the names of the table's attributes, the data types of the table's attributes, the formats of the table's attributes, and the maximum number of rows that the table can have...

    Extended Backus Naur Form

    It was developed as an extension of the original Backus Naur Form (BNF) by John Backus and Peter Naur in the 1960s. EBNF provides a more detailed and flexible method for defining the structure of a ...

    MIBBrowser8.rar

    the SNMP Trap and SNMP Inform packets that were sent from arbitrary SNMP devices or applications on the network. MIB Browser can monitor several SNMP devices simultaneously and contains features like...

    Design Concepts in Programming Languages

    The book's unique approach is based on a family of syntactically simple pedagogical languages that allow students to explore programming language concepts systematically. It takes as premise and ...

    tog-card-client

    【tog-card-client】是一个项目模板,它为开发React应用程序提供了一个基础框架,使用了现代前端技术栈,包括Typescript、Tailwind CSS、SASS、ESLint和Prettier。这个项目旨在帮助开发者快速启动一个新的React项目...

    extjs4.0.7附带的jsb3文件,已修正路径错误

    在EXTJS 4.0.7版本中,由于路径错误可能会导致JSBuilder无法正确解析和处理JSB3文件,因此提供的"已修正路径错误"的jsb3文件解决了这个问题。将这个修复后的sdk4.0.7.jsb3文件放置在EXTJS框架的根目录下,确保...

    Pragmatic Guide to Sass 3

    《Pragmatic Guide to Sass 3》是一本由Hampton Lintorn Catlin与Michael Lintorn Catlin共同编写的关于Sass(Syntactically Awesome Style Sheets)的专业指南。本书旨在帮助前端开发者更好地理解和运用Sass这一...

    CSS: The Missing Manual, 4th Edition

    ### CSS: The Missing Manual, 4th Edition - 关键知识点概览 #### 一、基础知识:HTML与CSS的结合 - **HTML5标签**:本书首先介绍了如何编写友好的HTML代码,特别是那些被现代浏览器所识别和支持的HTML5标签。这...

    mern-azure-client

    标题"Mern-azure-client"揭示了我们正在讨论的是一个基于MERN栈的项目,它已经集成了Azure服务,特别是客户端部分。MERN是MongoDB、Express.js、React和Node.js的首字母缩写,是一种流行的JavaScript全栈开发框架。...

    The-First-Timers

    【标题】:“The-First-Timers”:一个关于幻想足球联赛的项目 在这个名为"The-First-Timers"的项目中,我们看到的是一场充满激情的幻想体育活动,特别是聚焦于足球领域的“第一个计时器”联赛。这个联赛已经进入了...

    Java.EE.and.HTML5.Enterprise.Application.Development

    Employ Syntactically Awesome Stylesheets, CSS3, and Sassy CSS Table of Contents Chapter 1 Introduction to Java EE and HTML5 Enterprise Development Chapter 2 Persistence Chapter 3 RESTful Resources ...

    man-in-the-mirror

    当与React结合使用时,CSS模块可以导入SASS(Syntactically Awesome Style Sheets)文件,这是一种预处理器,扩展了CSS,增加了变量、嵌套规则、混合等功能。SASS文件可以编译成普通的CSS,然后作为模块在JavaScript...

    Android代码-AQuery

    AQuery is a lightweight library that allows UI manipulation in a syntactically similar way to the Javascript library JQuery. AQuery aims to remove the boilerplate code that comes with UI manipulation ...

    The12thAstronaut.github.io:网站存储库

    "SCSS"是Sass(Syntactically Awesome Style Sheets)的预处理器,它扩展了CSS语言,引入了变量、嵌套规则、混合、函数等特性,使得CSS编写更易于维护和扩展。SCSS文件可以被编译成标准的CSS格式,供浏览器解析使用...

    The Bootstrap

    通过Sass(Syntactically Awesome Stylesheets)预处理器,可以调整颜色、字体、间距等变量,轻松创建独特的品牌形象。 5. **JavaScript插件**:除了基本的CSS组件,Bootstrap还包含了一系列基于jQuery的JavaScript...

    sublime 编译sass时CompatibilityError

    ### Sublime Text 编译 SASS 时遇到的 Encoding::CompatibilityError 错误解析及解决方法 #### 一、问题背景介绍 Sublime Text 是一款非常受欢迎的代码编辑器,因其轻便且功能强大而备受开发者青睐。SASS ...

    快速JSON序列化Easyjson.zip

    such cases, so that they may be fixed sooner.Unsafe package is used by the code. While a non-unsafe version of easyjson can be made in the future, using unsafe package simplifies a lot of code by...

Global site tag (gtag.js) - Google Analytics