NutzCN Logo
问答 nutz前端传递对象中包含数组,后端应该怎么接收
发布于 1028天前 作者 wx_g5rmh75r1uqrjd0u5l54 1228 次浏览 复制 上一个帖子 下一个帖子
标签:
jQ.ajax({
                type: "POST",
                url: contextPath + "/TPmfbqdWhAct/setSupplementalToContract.nutz",
                data: {"supplementIds": supplementIds,"contractId": '<%= request.getParameter("contractId")%>'},
                success: function () {
                    parent.window.location.reload();
                }
            })

代码中supplementIds是一个字符串数组,contractId是字符串

@At
    @Ok("json")
    public Map<String, Object> setSupplementalToContract(HttpServletRequest request,
                                                         @Param("supplementIds") String[] supplementIds,
                                                         @Param("contractId") String contractId,
                                                         @Attr("userInfo") User user) throws Exception {
        return logic.setSupplementalToContract(request, supplementIds,contractId, user);
    }

supplementIds始终是null

2 回复

成功了,前端转jsonstring,后台加了@AdaptBy(type = JsonAdaptor.class),成功接收

添加回复
请先登陆
回到顶部