错误:
原因:自己马虎忘记加" / ",罚继续写代码┭┮﹏┭┮
前端代码:
<h1>添加功能</h1> <form action="test/1002/清秋/111" method="post">
<!--此处的POST尽量使用大写,小写可能不识别导致报错--> <input type="hidden" name="_method" value="POST"> <input type="submit" value="这是测试添加功能"> </form>
后台代码:
修改后的代码:
@RequestMapping(value="/test/{id}/{username}/{password}",method=RequestMethod.POST) public String testPost(@PathVariable("id")int id,@PathVariable("username")String username,@PathVariable("password")String password){ System.out.println("这是添加功能"); System.out.println(id+" "+username+" "+password); return "redirect:/test"; }