又见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 ...
随机推荐
- Python实现队列
队列的数据结构的主要结构:一个结点类和两个方法:出队列和进队列 class Node(object): def __init__(self,val): self.val = val self.next ...
- Python之面向对象:闭包和装饰器
一.闭包 1. 如果一个函数定义在另一个函数的作用域内,并且引用了外层函数的变量,则该函数称为闭包. def outter(): name='python' def inner(): print na ...
- 为Ubuntu Gnome环境创建桌面快捷方式
为Ubuntu Gnome环境创建桌面快捷方式 安装gnome-panel包 sudo apt-get install --no-install-recommends gnome-panel 启动终端 ...
- HDU 4649 Professor Tian (概率DP)
Professor Tian Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)To ...
- [摸鱼] 配置的vim的使用攻略!
vim使用攻略 <>=f 折叠与缩进 开:<>[^fuck]cc 关:<>cu 缩进一块使用V选中,按>> [Ctrl]V 以列为单位选 za,打开或关 ...
- YYH的积木(NOIP模拟赛Round 6)
题目描述 YYH手上有n盒积木,每个积木有个重量.现在他想从每盒积木中拿一块积木,放在一起,这一堆积木的重量为每块积木的重量和.现在他想知道重量最少的k种取法的重量分别是多少. 输入输出格式 输入格式 ...
- J.U.C并发框架源码阅读(十)ConcurrentLinkedQueue
基于版本jdk1.7.0_80 java.util.concurrent.ConcurrentLinkedQueue 代码如下 /* * ORACLE PROPRIETARY/CONFIDENTIAL ...
- HDU 6166.Senior Pan()-最短路(Dijkstra添加超源点、超汇点)+二进制划分集合 (2017 Multi-University Training Contest - Team 9 1006)
学长好久之前讲的,本来好久好久之前就要写题解的,一直都没写,懒死_(:з」∠)_ Senior Pan Time Limit: 12000/6000 MS (Java/Others) Memor ...
- Kerberos(转:http://www.cnblogs.com/jankie/archive/2011/08/22/2149285.html)
Kerberos介绍(全) 微软Windows Server 2003操作系统实现Kerberos 版本5的身份认证协议.Windows Server 2003同时也实现了公钥身份认证的扩展.Ke ...
- 【高精度】高精度数除以低精度数I
问题 G: [高精度]高精度数除以低精度数I 时间限制: 1 Sec 内存限制: 512 MB提交: 173 解决: 71[提交] [状态] [讨论版] [命题人:] 题目描述 修罗王聚集了庞大的 ...