springmvc接收参数老是为null

后台代码:
@RequestMapping(value="/login",method=RequestMethod.POST)
@ResponseBody
public Map login(String username,String password,HttpServletRequest request,HttpServletResponse response){

    return null;
}
username 和 password一直为null

前台参数:(是用jemeter提交的)
Content-Type:application/json;charset=UTF-8
{
'username':'admin2',
'password':'123'
}

Content-Type:application/json 对应参数前加 @RequestBody
如果不想修改后台代码,js中Content-Type: text/html或者省略

你可以去把request中所有的paramterName打印出来看看所有的参数的名称是什么

刚才没注意你的content-type为json类型,你可以使用@requestBody来接收参数,而不是你这种方式

后台没问题,应该是前台没有把数据传过去。

json参数要用request.getparamter("username")这个方法才能拿到

用request.getParamter接一下这两个参数试一试