2、esulttype="json"/>它得到的是json数据,但是autocomplete解析不出这样的json格式,所以读取不出来,结果为:{"entities":[{"id":2,"name":"老王","price":222.0},{"id":1,"name":"老王","price":222.0},{"id":3,"name":"老王","price":222.0},{"id":4,"name":"老王","price":222.0},{"id":5,"name":"老王","price":222.0}].2.第二种:如果加上param
3、的name为多的那个对象,则可以返回的是json数据entities返回的数据为:[{"id":2,"name":"老王","price":222.0},{"id":1,"name":"老王","price":222.0},{"id":3,"name":"老王","price":222.0},{"id":4,"name":"
4、老王","price":222.0},{"id":5,"name":"老王","price":222.0}]可见返回的是json数据,并且在智能提示中可以提取出来,可以得知:entities的意思是从根节点为entities的开始遍历,所有看到的数据就是json数据了。1.如果在action中封装的是一个实体,也就是查询的是一条数据,则代码为:privateGoodsentity;publicGoodsgetEntity(){returnentity;}响应的数据为:{"entity":{"id":1,"na
5、me":"老王2","price":222.0}}2.如果加上param参数,则返回的是entity结果为:{"id":1,"name":"老王2","price":222.0}3.如果在action中的数据为:privateListentities;privateGoodsentity;publicList<
6、Goods>getEntities(){returnentities;}publicGoodsgetEntity(){returnentity;}在xml文件中的数据为:entity则返回的只是entity对应的实体{"id":1,"name":"老王2","price":222.0}1.如果为:7、oods"class="cn.csdn.hr.action.GoodsAction">entities则返回的只是entities的实体,为[{"id":2,"name":"老王","price":222.0},{"id":1,"name":"老王","price":222.0},{"id":3,"name":"老王","price":222.0},{"id":4,"name":"老王","price":222.0},{"id":5,"
8、name":"老王","price":