【问题标题】:events not loading :jquery Full Calendar Java integration事件未加载:jquery Full Calendar Java 集成
【发布时间】:2011-07-26 22:13:02
【问题描述】:

我正在尝试通过控制器将事件加载到完整日历

这是我在 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();
    }

请求和响应显示正常状态并且 我可以看到响应在萤火虫中作为 json 发送回 {"id":111,"title":"event1","start":"2011-07-28","url":"http:// /yahoo.com/"}

但是,完整的日历不会显示加载的事件。我错过了什么吗?

提前感谢您的帮助。

【问题讨论】:

    标签: java jquery fullcalendar


    【解决方案1】:

    您是否尝试过从title: 'title,' 中删除逗号?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-01-13
      • 2013-06-15
      • 1970-01-01
      • 1970-01-01
      • 2011-08-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多