cxf webservice 返回json字符串时,数值型的字符串双引号不见了
cxf webservice 返回json字符串时,数值型的字符串双引号不见了,在线等在使用cxf框架构建rest方式的webserv
cxf webservice 返回json字符串时,数值型的字符串双引号不见了,在线等
在使用cxf框架构建rest方式的webservice的应用的时候
如:
使用jaxb注解定义一个返回对象
Java code@XmlRootElement(name="usermain")public class UserMain extends UserInfo{ public String name; // get set method}
Java code@XmlRootElement(name="userinfo")public class UserInfo{ public String id; // get set method}
UserMain继承了UserInfo的id属性!!!
得到的UserMain json 字符串应该是:
{"id":"123","name":"hello"}
但是id值少了引号:
{"id":123,"name":"hello"}
不知道各位大侠有知道原因的吗?
试了一下,在UserMain中重载一下其父类UserInfo的id属性就可以解决问题,但是感觉这个不是解决根本原因,求助~~~
[解决办法]http://fly2wind.iteye.com/blog/730350