未加载事件:jquery完整日历Java集成
我正试图通过控制器将事件加载到完整的日历中
以下是我在jsp上的脚本:
$(document).ready(function () {
var calendar = $('#calendar').fullCalendar({
editable: true,
eventSources: [{
// your event source
url: 'calendarDetails',
type: 'GET',
data: {
start: 'start',
id: 'id',
title: 'title,'
},
error: function () {
alert('there was an error while fetching events!');
},
color: 'yellow',
textColor: 'black'
}])
};)
};
在我的控制器里:
@RequestMapping(value="/calendarDetails", method=RequestMethod.GET)
public @ResponseBody void showCalendarDetails(HttpServletResponse response){
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", 111);
map.put("title", "event1");
map.put("start", "2011-07-28");
map.put("url", "http://yahoo.com/");
// Convert to JSON string.
String json = new Gson().toJson(map);
logger.info(json);
// Write JSON string.
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
try {
response.getWriter().write(json);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
请求和响应显示ok(正常)状态和 在firebug中,我可以看到作为json返回的响应是{“id”:111,“title”:“event1”,“start”:“2011-07-28”,“url”:http://yahoo.com/“}
但是,完整的日历不会显示加载的事件。我错过什么了吗
提前感谢你的帮助
共 (0) 个答案