错误The request sent by the client was syntactically incorrect ()的解决

类属性的类型不一样也会造成这种情况

这个错误是SpringMVC报出来的,见到它意味着html/jsp页面的控件名称 和 controller里函数的参数不符。

好比界面有个这样的form

    <form name="form1" action="uploadDocument.html" method="post" ENCTYPE="multipart/form-data">
    <div class="form" >
            <p>
                <span class="req"><input id="remarkTxt"  name="remarkTxt" class="field size4" title="Enter the date" /></span>
                <label>Remark: <span>(The brief introduction of the file)</span></label>
            </p>

            <p>
                <span class="req"><input type="file"  name="uploadFileCtrl" class="field size4" title="Choose the file" /></span>
                <label>Upload file: <span>(Click browse to choose)</span></label>
            </p>
    </div>

    <div class="buttons">
        <input id="queryBtn" type="button" class="button" value="Submit" />
    </div>

    </form>

而对应的函数参数应该这样写:

@RequestMapping(value="/uploadDocument")
    public String uploadDocument( @RequestParam("remarkTxt") String remark,
                                  @RequestParam("uploadFileCtrl") MultipartFile file,                                  HttpServletRequest request,                                  HttpServletResponse response){    ....    }}

注意上述粗体字的一一对应关系。

时间: 2024-08-07 07:16:18

错误The request sent by the client was syntactically incorrect ()的解决的相关文章

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

问题:错误400-The request sent by the client was syntactically incorrect. springMVC中,某个页面提交时报400错误,如下图. 解决方法: 1.在网上找了一下,答案是通常遇到这个错误是因为前端jsp页面的控件名称和controller中接收的参数名称不一致.但仔细对比了一遍发现没有问题.很郁闷. 2.然后就反复的提交那个页面进行测试,发现了问题,因为我是将多个参数作为一个实体传至controller,发现某个文本框为空时,提交

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

在SpringMVC中使用@RequestBody和@ModelAttribute注解时遇到了很多问题,现记录下来. @ModelAttribute这个注解主要是将客户端请求的参数绑定参数到一个对象上,不用将很多参数@RequestParam或是@PathVariable. 但是在使用过程中遇到了问题, 第一次Html端请求代码如下,请求方式1 // 简单键值对 var data = { productTypeIds : vproducttypeid, channelTypeId : vchan

错误400-The request sent by the client was syntactically incorrect

出错部分是学习SpringMVC 时学习https://my.oschina.net/gaussik/blog/640164,在添加博客文章部分出现了这个问题. The request sent by the client was syntactically incorrect 说的意思是:由客户端发送的请求是语法上是不正确的. 上网找了很多资料,大部分都是说前端jsp页面的控件名称(name)和controller中接收的参数名称不一致,检查以后确实存在这个问题,修改以后还是没有解决,这说明别

400 Bad Request The request sent by the client was syntactically incorrect ().

项目中一直出现400错误,后面搜索下,发现如下内容. SpringMVC报错信息为The request sent by the client was syntactically incorrect () 在数据绑定的时候一定要主意Controller方法中的参数名和jsp页面里的参数名字是否一致或者按照绑定的规范来写,如果不一致,可能回报如下错误: The request sent by the client was syntactically incorrect (). 从字面上理解是:客户

解决SpringMVC入参出现The request sent by the client was syntactically incorrect请求语法错误方法

使用SpringMVC出现The request sent by the client was syntactically incorrect.请求错误如下: 可以确定为提交的表单数据和目标方法的入参不一致所导致,表单数据可以多于目标入参个数,但目标参数没有被赋值,则会出现该异常,如下情况: 表单数据: 目标方法: Employee字段: 比对表单数据和Employee字段,可以发现,表单数据比Employee字段少,再加上目标方法的入参是一个 Employee对象,所以将会出现提交的数据不足,

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

前几天遇到过这个问题(Ref:http://www.cnblogs.com/xiandedanteng/p/4168609.html),问题在页面的组件name和和注解的@param名匹配不对,这个好解决,一一对好就行了. 但是,这回情况不一样了,我的页面控件是类似这样的: <p style="height:280px;display:block;"> <span class="req"> <label><input typ

(SpringMVC)报错:The request sent by the client was syntactically incorrect ()

springMVC数据绑定,对我们而言,能够更轻松的获取页面的数据,但是必须要注意的一点就是: Controller方法中的参数名和jsp页面里的参数名字是否一致或者按照绑定的规范来写 在Controller中@RequestParam("m_level") Integer m_level 那么在jsp页面上的数据 <select name="m_level"> <option value="一级">一级</opti

The request sent by the client was syntactically incorrect. 400 问题

The request sent by the client was syntactically incorrect. 这个问题是因为 SpringMvc controller 里面的方法参数和请求参数不匹配. 请求参数在 Contoller 的方法参数对象中不存在则会报这个错误. 如 : Controller 里面的方法 @RequestMapping(value = "/login/signin", method = RequestMethod.POST) public @Resp

服务器,tomcat,网页请求错误400,The request sent by the client was syntactically incorrect的问题

这是今天项目中遇到的一个让我纠结的问题,当时特郁闷,找了半天也没找到原因.最后一点一点的 测试提交数据才慢慢发现其中的端倪,最后也给遇到类似问题的朋友一点建议吧! 我的项目是运用SpringMVC作为控制层,然后是添加页面,页面需要提交一堆数据到服务器,当 写完数据提交的时候,并没有如我想象的那样跳入控制层,而跳入下面页面: 这个让我纠结了,以前都没遇到过,这个错误的原因看描述应该是说,客户端提交的请求在语法有错误, 想了半天,最后想到了,可能是数据传入后台的时候进行绑定出错了,然后发现我提交的