又见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 ...
随机推荐
- Velocity模版使用
<!-- https://mvnrepository.com/artifact/org.apache.velocity/velocity --> <dependency> &l ...
- 汕头市队赛 SRM1X T1
木之本樱 背景 “西瓜是可以种在树上的!”——木之本樱 描述 空地上,一排排的西瓜树拔地而起. 魔法世界里,空地是无限大的.所有的树排成了n条直线,每条直线也是向左右两端无限延伸的. 由于自己姓木(之 ...
- 手动删除Win7系统服务列表中残留服务的操作步骤
卸载tomcat的时候服务用cmd运行不能删除 需要用管理员才能删除 手动删除Win7系统服务列表中残留服务的操作步骤分享给大家,在使用深度Win7系统过程中,将一些程序删除后,有些在服务列表中还会残 ...
- GPS经纬度的表示方法及换算
想要认识GPS中的经纬度,就必须先了解GPS,知道经纬度的来源: 1. GPS系统组成 GPS是 Gloabal Positioning System 的简称,意为全球定位系统,主要由地面的控制站.天 ...
- poj 1329(已知三点求外接圆方程.)
Circle Through Three Points Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 3766 Acce ...
- [BZOJ1997][Hnoi2010]Planar 2-sat (联通分量) 平面图
1997: [Hnoi2010]Planar Time Limit: 10 Sec Memory Limit: 64 MBSubmit: 2317 Solved: 850[Submit][Stat ...
- (2)OLEDB数据库操作
1.首先要引入 System.Data.OracleClient.dll 2.引入命名空间 using System.Data.OleDb; OleDb类 https://msdn.microsof ...
- Codeforces Round #306 (Div. 2) A. Two Substrings【字符串/判断所给的字符串中是否包含不重叠的“BA” “AB”两个字符串】
A. Two Substrings time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...
- UVALive 3027 Corporative Network (带权并查集)
题意: 有 n 个节点,初始时每个节点的父节点都不存在,你的任务是执行一次 I 操作 和 E 操作,含义如下: I u v : 把节点 u 的父节点设为 v ,距离为| u - v | ...
- Python的程序结构[8] -> 装饰器/Decorator -> 装饰器浅析
装饰器 / Decorator 目录 关于闭包 装饰器的本质 语法糖 装饰器传入参数 1 关于闭包 / About Closure 装饰器其本质是一个闭包函数,为此首先理解闭包的含义. 闭包(Clos ...