I'm putting the FullCalendar component into my Java application. I'm having trouble loading events into the calendar.
How do I read json from within my js file?
The following is the code below:
JS file:
$.noConflict();
jQuery(document).ready(function($) {
$('#calendar').fullCalendar({
defaultDate: '2016-02-01',
editable: true,
eventLimit: true,
eventClick: function (calEvent, jsEvent, view) {
$("#title").val(calEvent.title);
$("#description").val(calEvent.description);
$("#start").val(calEvent.start);
Richfaces.showModalPanel('panelCalendar');
},
events: "C:/Projetos/Web/ProjetoCalendario/build/web/WEB-INF/classes/wpos/controle/utilidades/WposExibeCalendario",
eventRender: function(event, element) {
if(event.type){
element.find(".fc-title").prepend("<i class='fa fa-"+event.type+"'></i>");
}
}
});
});
File ExibeCalendario.java
:
public class WposExibeCalendario extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
List l = new ArrayList();
CalendarDTO c = new CalendarDTO();
c.setId(1);
c.setStart("2016-02-20");
c.setEnd("2016-02-20");
c.setTitle("Task in Progress");
CalendarDTO d = new CalendarDTO();
d.setId(2);
d.setStart("2016-02-21");
d.setEnd("2016-02-21");
d.setTitle("Task in Progress1");
l.add(c);
l.add(d);
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
out.write(new Gson().toJson(l));
}
}
File CalendarioDTO.java
:
package br.com.advpos.entities;
public class CalendarDTO {
public int id;
public String title;
public String start;
public String end;
public String color;
// getters e setters
}
I am not able to search within my js the class that does the js conversion. Can you help me please?