问题描述:
把java对象转换成xml,对象中有集合,集合中又有对象,描述:对象A中有一个List<B>,list集合中的对象是B
使用的jar包是:jre自带的rt.jar包
解决方法:
代码示例如下
ReturnResXml.java
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
//根节点
@XmlRootElement(name = "Response")
@XmlAccessorType(XmlAccessType.FIELD)
//节点属性
@XmlType(propOrder = { "RetCode","RetMsg","Number","Student"})
public class ReturnResXml{
private Integer RetCode;
private Str