事实证明,当从外部获取日历源时,fullcalendar 插件将添加开始和结束 HTTP 参数。此处的文档中描述了完整的详细信息:http: //arshaw.com/fullcalendar/docs/event_data/events_json_feed/
我的代码(javascript、JSP、JSF 的混合):
- FullCalendal 初始化:
page.view.calendar.fullCalendar(
{
....
eventSources: [
page.control.initEventSources(#{sessionBean.myCalendar.calendarConfgIdNbr},'Approved'),
page.control.initCalendarHolidays(#{sessionBean.myCalendar.calendarConfgIdNbr})],
....
});
2.我的javascript函数:page.control.initEventSources:
var page = {
control : {
initEventSources : function(calConfId, status) {
return {
url: '/oceportal/tom/data/bookings.jsp',
type: 'POST',
data: { calConfId: calConfId, bookingStatus: status, loggedInId: "#{sessionBean.loggedInId}", },
success: function(data) { },
error: function() { alert('there was an error while fetching events!'); },
color: 'none',
textColor: page.colorConfig[status]
};
}
}
}
我的 JSP 片段(检索第一个和最后一个可见日):
String start = request.getParameter("start");
Date startDt = new Date(Long.parseLong(start)*1000);
String end = request.getParameter("end");
Date endDt = new Date(Long.parseLong(end)*1000);
希望它可以帮助某人。