问题遇到的现象和发生背景
提交表单,不能成功跳转页面
问题相关代码,请勿粘贴截图
@RequestMapping(value = "/user",method = RequestMethod.PUT)
public String updateUser(String username,String password){
System.out.println("修改用户信息:" + username + ","+ password);
return "success";
}
<form action="${pageContext.request.contextPath}/user" method="post">
<input name="_method" value="put" type="hidden"/>
用户名:<input type="text" name="username"><br>
密码:<input type="password" name="password"><br>
<input type="submit" value="修改"><br>
</form>
运行结果及报错内容
我的解答思路和尝试过的方法
配置了HiddenHttpMethodFilter
<filter>
<filter-name>HiddenHttpMethodFilter</filter-name>
<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>HiddenHttpMethodFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>