又见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 type="checkbox" value="A" name="to" /> A</label>
<label><input type="checkbox" value="B" name="to" /> B</label>
<label><input type="checkbox" value="C" name="to" /> C</label>
</span>
<label><span></span></label>
</p>
而控制器是这样写的:
@RequestMapping(value="/sendEmailReport")
public String sendEmailReport(@RequestParam("idTxt") String id,
@RequestParam("to") String[] to,
@RequestParam("cc") String[] cc,
@RequestParam("bcc") String[] bcc,
HttpServletRequest request,
HttpServletResponse response){
。。。
}
看,to部分对应一点没错,但是,问题来了,如果name为to的一组复选框一个都没有选中的话,那么,提交页面后就会报The request sent by the client was syntactically incorrect ()错误。
但是,如果哪怕只要选中一个,程序就正常运行了。
我是通过添加一个默认的隐藏的选中复选框来避免这个错误的,代码如下:
<p style="height:280px;display:block;">
<span class="req">
<label><input type="checkbox" value="A" name="to" /> A</label>
<label><input type="checkbox" value="B" name="to" /> B</label>
<label><input type="checkbox" value="C" name="to" /> C</label>
<label><input type="checkbox" value="" checked name="to" style="display:none;"/></label>
</span>
<label><span></span></label>
</p>
这样,这组复选框就不必非要选中一个了,当然,后台需要添加点过滤措施。
应该是SpringMVC自身的问题,希望它能修正这个Bug。
又见The request sent by the client was syntactically incorrect ()的更多相关文章
- SpringMVC报错The request sent by the client was syntactically incorrect ()
springmvc数据绑定出的错 在数据绑定的时候一定要主意Controller方法中的参数名和jsp页面里的参数名字是否一致或者按照绑定的规范来写, 如果不一致,可能回报如下错误: The requ ...
- "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 ...
- 错误:The request sent by the client was syntactically incorrect的解决
问题: 错误400-The request sent by the client was syntactically incorrect. springMVC中,某个页面提交时报400错误,如下图. ...
- spring mvc 在上传图片时,浏览器报The request sent by the client was syntactically incorrect
项目中,在一个jsp页面里其它图片上传是功能是可以使用的,当我自己新加了一个图片上传时,提交表单后,浏览器报The request sent by the client was syntactical ...
- SpringMVC---400错误The request sent by the client was syntactically incorrect ()
在SpringMVC中使用@RequestBody和@ModelAttribute注解时遇到了很多问题,现记录下来. @ModelAttribute这个注解主要是将客户端请求的参数绑定参数到一个对象上 ...
- 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 ...
- 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 ()的解决
http://www.cnblogs.com/xiandedanteng/p/4168609.html 这个错误是SpringMVC报出来的,见到它意味着html/jsp页面的控件名称 和 contr ...
随机推荐
- hdu 4359 dp
/* 题目大意:给n个节点的二叉树第i个节点的权值为2^(i-1), 求所有含左右子树的节点都符合左子树的权和小于右子树权和的种数. */ #include <iostream> #inc ...
- 编写Shell脚本的最佳实践,规范二
需要养成的习惯如下: 代码有注释 #!/bin/bash # Written by steven # Name: mysqldump.sh # Version: v1.0 # Parameters : ...
- Sql Server 事务/回滚
,'test1','test1') commit tran t1 ---提交事务 功能:实现begin tran 和commit tran之间的语句,任一如果出现错误,所有都不执 事务不是有错就回滚 ...
- 基于UDP高性能传输协议UDT doc翻译(一)
原文转自:http://hi.baidu.com/doodlezone/item/74a203155efe26dbbf9042dd UDT文档阅读理解 一. 概述 ...
- ubuntu软件包管理
ubuntu安装好了后首先要会下载和管理系统的软件包:ubuntu的软件管理方式是apt-get 安装软件包apt-get harvey@ubuntu:/var/cache/apt$ which ap ...
- bottle框架学习(1):命令行
在最初的一段代码,内容如下: if __name__ == '__main__': from optparse import OptionParser _cmd_parser = OptionPars ...
- hdu 5087(次长上升子序列)
Revenge of LIS II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others ...
- Python3在Windows安装配置及简单试用
1,安装配置 安装版本是Python3.5,我的安装路径是E:\ImProgram\Python35 添加环境变量,将上述路径加入到path中 这样cmd打开命令窗口,输入python就能看到调用成功 ...
- MVC 视图与控制器传值的几种方法
一.页面取值传给控制器 1.表单传值----利用Action 视图页: <form action="方法名" method="post" ...
- Codeforces 914D Bash and a Tough Math Puzzle (ZKW线段树)
题目链接 Round #458 (Div. 1 + Div. 2, combined) Problem D 题意 给定一个序列,两种询问:单点修改,询问某个区间能否通过改变最多一个数使得该区间的 ...