又见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 ...
随机推荐
- 飞思卡尔MC9S12系列单片机地址影射以及分页问题
对于用MCU的人来说,不一定要明白HCS12(x) memory map的机制和联系.因为如果没有系统地学习操作系统和编译原理之类的课程,确实有些难度.并且,对于DG128 XS128这样的MCU,默 ...
- 【TEST】NOI-Linux可用 gedit c++精简配置 附Emacs日常配置
这里是backup的测试随笔,用于测试 CSS / Markdown 效果. 同时也是是本菜鸡考场上一般使用的Gedit配置. 只有6行,挺短的.应该算好记吧. 使用之前记得勾选首选项里的外部工具. ...
- 汕头市队赛 SRM 08 A
比赛没参加 所以回来补题咯 A还是自己YY出来了的 可惜比赛没有打 描述 给一个 01 串设为其 S,询问是否存在只出现两次的 01 串 T. 这里的出现定义为存在一串下标 ,满足 且 . 输入格式 ...
- HDU 3389 Game (阶梯博弈)
Game Time Limit: 1000MS Memory Limit: 32768KB 64bit IO Format: %I64d & %I64u Submit Status D ...
- YYH算组合数(NOIP模拟赛Round 6)
题目描述 YYH手上有一个长度为N的数列,而且这个数列正好能表示为.现在他想知道这个数列的最大公约数是多少,请你帮帮他 输入输出格式 输入格式: 每个数据点包括多组数据,以EOF结束 对于每个数据输入 ...
- andrio
## 以eclipse -clean命令从命令行启动 eclipse ## 配置Android模拟器 点击上图右边的按钮(像个手机一样的),打开AVD管理器后,点击 New 新建一个模拟器,输入Nam ...
- Linux内核中的中断栈与内核栈的补充说明【转】
转自:http://blog.chinaunix.net/uid-12461657-id-3487463.html 原文地址:Linux内核中的中断栈与内核栈的补充说明 作者:MagicBoy2010 ...
- 我读过的最好的epoll讲解--转自”知乎“ 【转】
转自:http://blog.csdn.net/xu3737284/article/details/12715963 首先我们来定义流的概念,一个流可以是文件,socket,pipe等等可以进行I/O ...
- 和菜鸟一起学c之gcc编译过程及其常用编译选项【转】
转自:http://blog.csdn.net/eastmoon502136/article/details/8162626 版权声明:本文为博主东月之神原创文章,未经博主允许不得转载. 上篇文章,知 ...
- undefined reference to XXX 问题原因
原文地址:http://blog.csdn.net/cserchen/article/details/5503556 Linux下编译程序时,经常会遇到“undefined reference to ...