I am doing an appointment application in Java using Struts2 framework. For that am implementing Fullcalendar plugin in my application. Am getting error.
calender.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: 'calender',
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>
calender.java
@ParentPackage("json-default")
@Action(value = "jsone", results = {
@Result(type = "json", name = "success")})
public class calender 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="calender"
class="com.Customer.calender"
method="execute" >
<result name="success">/calender.jsp</result>
<result name="error">/error.jsp</result>
</action>
In jsp am getting parsererror::SyntaxError: Unexpected token < Actually i don't know where the error resides. If anyone implemented fullcalender suggest me any docs asap.
Thanks for your replies. I got solution actually am using struts2.3.4. I googled and someone says it may be because of dependies(i.e.,libraries/jar) and should use same version struts2.3.4,xwork-core2.3.4 and struts2.json-plugin2.3.4. But previously i used struts2.json-plugin2.1.8 now i replaced it to struts2.json-plugin2.3.4 now it is working fine.