今天前台使用vue-resource 做东西的时候 使用其 post的方式 后台Controller 获取不到参数。
解决方式:
前台html:
Vue.http.options.emulateJSON = true;
this.$http.post('/f/test/findTestByPost',{id:this.ruleForm.id}).then(function(res){
this.ruleForm=res.data.testList;
})
后台Controller:
@RequestMapping("/findTestByPost")
@ResponseBody
public TestList findTestByPost(@RequestParam("id") String id, Model model) {
this.logger.debug("\n id:{}", id);
return null;
}