(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="一级">一级</option>

</select>

上述这种写法是错误的,首先子value中的值必须和Controller中的值保持同一种规范,即都是Ineger类型的数据

而“一级”是String类型的,这样就会出现报错:

The request sent by the client was syntactically incorrect ()

修改的方法为:将value的值改为1(Integer);

另一方面:参数名字是否一致也会产生这种异常

如@RequestParam(value="level" required="true")Integer m_level

而在jsp页面中

<select name="m_level"></select>

那么也会出现这种错误

修改的方法为:将@RequestParam(value="m_level"required="true")Integer m_level即可

posted on 2016-10-16 12:48  知其一叶  阅读(150)  评论(0编辑  收藏  举报

导航