求解一个Sprint Mvc Post多参数 提交时获取不到参数的问题

JsonRead JsonRead 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
如题 Java新手,用SpringBoot框架写了个接口,需要传递多参数,多个String类型的参数是可以获取到的,但是参数中有实体参数时,后台获取到的为Null,换了多种方式都不行,使用C# 的Action可以获取到参数,求解
Js调用代码

<script type="text/javascript">
function doPost5()
{
console.log("start");

var fileModuleKeyL = {
ModuleName: "abc",
ModuleKey:"123"
};

var fileGuidL = "xxxxxxxxxxxxxxx1111";


$.post("http://localhost:6503/doModel", { fileModuleKey: fileModuleKeyL, fileGuid: fileGuidL }, function (result) {
console.log(result);
});
}
</script>


Java代码

@RequestMapping(value = "/doModel",method = RequestMethod.POST)
public void doModel(
@RequestBody FileModuleKey fileModuleKey,
@RequestParam(value = "fileGuid", required = false) String fileGuid){
System.out.println(fileModuleKey.getModuleKey());
System.out.println(fileGuid);
}

...全文

相关推荐

评论 9
收藏 已收藏
分享
返回顶部
JsonRead
Web 开发 81,108 成员 341,721 内容