I am currently developing an appointment scheduling application in Java using the Struts2 framework. As part of this project, I have integrated the Fullcalendar plugin into my application. However, I am encountering an error.
calendar.jsp
<script type="text/javascript">
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: false,
eventLimit: true,
events: function (start, end, timezone, callback) {
$.ajax({
url: 'calendar',
dataType: 'json',
success: function (doc) {
alert(doc);
var events = [];
events.push({
title: doc.title,
start: doc.start,
end: doc.end
});
callback(events);
},
error: function (xhr, errorType, error)
{
alert(xhr.responseText+"::"+errorType + "::" + error);
}
});
}
});
</script>
calendar.java
@ParentPackage("json-default")
@Action(value = "jsone", results = {
@Result(type = "json", name = "success")})
public class calendar extends ActionSupport {
private String title;
private String start;
private String end;
public String execute() {
title = "Event";
start = "2014-10-24";
end = "2014-10-24";
return SUCCESS;
}
//Getters & Setters
}
struts.xml
<action name="calendar"
class="com.Customer.calendar"
method="execute" >
<result name="success">/calendar.jsp</result>
<result name="error">/error.jsp</result>
</action>
While working on the jsp page, I encountered the following error: parsererror::SyntaxError: Unexpected token <. Unfortunately, I am unsure where exactly the error is occurring. If anyone has experience implementing Fullcalendar, please share any helpful documentation or resources with me as soon as possible.