0
內部列表並不返回一個JSON字符串..只有第一個數據表是回報...如何獲取數據列表作爲JSON字符串
有沒有辦法讓所有的數據作爲JSON字符串?
------我的方法---------------------
@RequestMapping(value="/mainreservationChart", method = RequestMethod.GET)
public ModelAndView getMRChartData(@ModelAttribute ("ReservationSummaryRQDTO") ReservationSummaryRQDTO search){
ReservationSummaryDTO returnDataDTO = new ReservationSummaryDTO();
MainReservationChartWSImpl wsImpl = MRWSUtil.getInstance().getWS_ServicePort();
search.setHotelCode("BBH");
search.setReportDate(toXmlDateGMT(new Date()));
returnDataDTO = wsImpl.getReservationSummary(search);
Map<String, Object> model = new HashMap<String, Object>();
model.put("status", true);
model.put("hotelCode", returnDataDTO.getHotelCode());
model.put("summary", returnDataDTO.getSummaryMonth());
model.put("data", returnDataDTO);
return new ModelAndView("jsonView", model);
}
的DTO
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "reservationSummaryDTO", propOrder = {
"hotelCode",
"summaryMonth"
})
public class ReservationSummaryDTO {
protected String hotelCode;
@XmlElement(nillable = true)
protected List<SummaryMonthDTO> summaryMonth;
}
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "summaryMonthDTO", propOrder = {
"month",
"summaryType"
})
public class SummaryMonthDTO {
protected String month;
@XmlElement(nillable = false)
protected List<SummaryTypeDTO> summaryType;
}
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "summaryTypeDTO", propOrder = {
"date",
"displaySequence",
"total",
"typeCode"
})
public class SummaryTypeDTO {
@XmlElement(nillable = true)
protected List<SummaryDateDTO> date;
protected Integer displaySequence;
protected Double total;
protected String typeCode;
仍然沒有得到完整的數據列表作爲JSON string..adding以上是給我下面的錯誤HTTP狀態406 ---由該請求所標識的資源只能生成與特性響應根據請求「接受」標題不可接受。 – Charitha 2013-05-10 03:52:16
你如何測試controlleres?使用休息客戶端? – 2013-05-10 04:07:21
嘗試添加Content-Type:application/json,Accept:application/json作爲客戶端的兩個頭部請求 – 2013-05-10 04:18:00