无法将@formbean字段类型启动为list< integer>或整数[]

发布于 2025-01-31 02:04:25 字数 698 浏览 2 评论 0原文

导入javax.ws.rs.formparam; 导入com.alibaba.fastjson.json;

大家好,JAX-RS似乎无法在Resteasy 2.x/3.x/4.x自动启动列表字段,

我在Servce中使用的VO

public class OrderVO {  
    @FormParam("id")
    private long id;    
    @FormParam("title")
    private String title;   
    @FormParam("product")
    private List<Integer> product;

    ...
    
    public String toString() {
        return JSON.toJSONString(this);
    }
}

@POST
@Consumes(MediaType.APPLICATION_FORM_URLENCODED+";charset=UTF-8")
@Path("/create")
public InsertResult saveOrder(@BeanParam OrderVO order) {
    logger.debug(order.toString());
    
}

这 或整数[],任何人都可以告诉我为什么...

import javax.ws.rs.FormParam;
import com.alibaba.fastjson.JSON;

Hi guys, The JAX-RS seems cannot init the list field in resteasy 2.x/3.x/4.x automatically,

Here is my VO used in servce

public class OrderVO {  
    @FormParam("id")
    private long id;    
    @FormParam("title")
    private String title;   
    @FormParam("product")
    private List<Integer> product;

    ...
    
    public String toString() {
        return JSON.toJSONString(this);
    }
}

And here is my service method:

@POST
@Consumes(MediaType.APPLICATION_FORM_URLENCODED+";charset=UTF-8")
@Path("/create")
public InsertResult saveOrder(@BeanParam OrderVO order) {
    logger.debug(order.toString());
    
}

Other parameters are auto inited except the List or Integer[], and can anyone tell me why....

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文