java - @RequestParam 获取参数值有问题
大家讲道理
大家讲道理 2017-04-18 10:45:41
0
2
766
大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(2)
刘奇

Did you include two pIDs in the parameters? For example:

http://.../showCorrelation?pID=34cb...&pID=3574...

req.getParameter("pID") will only get one of them (if there are multiple parameters with "pID" as the key parameter, please check the Javadoc of Servlet API or the source code of Servlet Container for the specific number). It will get all of them. Parameters with "pID" as key must use req.getParameterValues();

Check how Spring MVC explains @RequestParam, or see how the source code implements it. Will it take out all the parameters with "pID" as the key? If there are more than one, use commas to connect them?

小葫芦

There is a problem with the return view, the reason is that we return json不返回视图,所以应该在HandlerExceptionResolver中将return null改为return new ModelAndView();

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!