【发布时间】:2017-12-18 17:53:18
【问题描述】:
我一直在谷歌上搜索这个,但没有相关的答案。我在我的 POST 方法中发布了一个 json 对象,但参数对象返回 null 值。 GET 工作正常
下面是我的POST方法:
@POST
@Produces(MediaType.APPLICATION_JSON)
public List<Parameter > postPayment(Parameter param){
//Example param.getValue return null
return getData(param);
}
setter 和 getter
public class Parameter {
protected String name;
protected String value;
public String getName() {
return name;
}
public void setName(String value) {
this.name = value;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
json 请求
{ “名称”:“名称 1”, “值”:“值 1” }
注意:我在 netbeans 上使用 JAX-RS
请您帮忙。谢谢
【问题讨论】:
-
您的问题解决了吗?如果是,请接受以下发布的答案之一,这会有所帮助