tags:

views:

45

answers:

0

Hi Sam! I think it's JS error! the servlet will response the josn data like this:

{"start":"2010-04-15","title":"changjiu","url":"http://yahoo.com/","id":115}

but I can't display the eventson my fullcalendar. Why? the servlet is:

[CalendarMap]
public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

    Map<String, Object> map = new HashMap<String, Object>();
    map.put("id", 115);
    map.put("title", "changjiu");
    map.put("start", new SimpleDateFormat("yyyy-MM-15").format(new Date()));
    map.put("url", "http://yahoo.com/");

    // Convert to JSON string.
    String json = new Gson().toJson(map);

    // Write JSON string.
    response.setContentType("application/json");
    response.setCharacterEncoding("UTF-8");
    response.getWriter().write(json);
    System.out.println(json);
    }
[JS]

$(document).ready(function() {
      $('#calendar').fullCalendar({
               eventSources: [
                       "CalendarMap"
                    ]
   });
  });