Javascript 通过servlet将数据库中的数据显示到fullcalendar中-未列出任何事件
这是我第一次使用.jsp和Netbeans。我正在尝试创建一个使用fullcalendar的系统,用户可以在其中选择月/年对,并显示在所选月份的哪一天休假的人员。基本上,它不会列出事件,而是列出缺席的员工姓名。我将把这些名称称为事件Javascript 通过servlet将数据库中的数据显示到fullcalendar中-未列出任何事件,javascript,java,jsp,netbeans,fullcalendar,Javascript,Java,Jsp,Netbeans,Fullcalendar,这是我第一次使用.jsp和Netbeans。我正在尝试创建一个使用fullcalendar的系统,用户可以在其中选择月/年对,并显示在所选月份的哪一天休假的人员。基本上,它不会列出事件,而是列出缺席的员工姓名。我将把这些名称称为事件 <form name="choose" method="POST"> <table class="centerTable"> <tr> <td>Month</td> <td>:&
<form name="choose" method="POST">
<table class="centerTable">
<tr>
<td>Month</td>
<td>:</td>
<td>
<select name="month" style="width:130px" required>
<option value="">Select a month:</option>
<option value="${01}" ${param.month == 01 ? 'selected' : ''}>January</option>
<option value="${02}" ${param.month == 02 ? 'selected' : ''}>February</option>
<option value="${03}" ${param.month == 03 ? 'selected' : ''}>March</option>
<option value="${04}" ${param.month == 04 ? 'selected' : ''}>April</option>
<option value="${05}" ${param.month == 05 ? 'selected' : ''}>May</option>
<option value="${06}" ${param.month == 06 ? 'selected' : ''}>June</option>
<option value="${07}" ${param.month == 07 ? 'selected' : ''}>July</option>
<option value="${08}" ${param.month == 08 ? 'selected' : ''}>August</option>
<option value="${09}" ${param.month == 09 ? 'selected' : ''}>September</option>
<option value="${10}" ${param.month == 10 ? 'selected' : ''}>October</option>
<option value="${11}" ${param.month == 11 ? 'selected' : ''}>November</option>
<option value="${12}" ${param.month == 12 ? 'selected' : ''}>December</option>
</select>
</td>
</tr>
<tr>
<td>Year</td>
<td>:</td>
<td>
<select name="year" style="width:130px" required>
<option value="">Select a year:</option>
<option value="${2016}" ${param.year == '2016' ? 'selected' : ''}>2016</option>
<option value="${2015}" ${param.year == '2015' ? 'selected' : ''}>2015</option>
<option value="${2014}" ${param.year == '2014' ? 'selected' : ''}>2014</option>
<option value="${2013}" ${param.year == '2013' ? 'selected' : ''}>2013</option>
<option value="${2012}" ${param.year == '2012' ? 'selected' : ''}>2012</option>
</select>
</td>
</tr>
<tr>
<td colspan=3 align=center>
<input type="submit" name="submit" value="Submit" onChange="submit();return false;">
</td>
</tr>
</table>
</form>
<script>
var y = "${param.year}";
var m = "${param.month}";
$(document).ready(function() {
$('#calendar').fullCalendar({
selectable: true,
selectHelper: true,
select: function(start, end) {
var title = prompt('Event Title:');
var eventData;
if (title) {
eventData = {
title: title,
start: start,
end: end
};
$('#calendar').fullCalendar('renderEvent', eventData, true);
}
$('#calendar').fullCalendar('unselect');
},
editable: true,
eventLimit: true,
events: "/Leave/KServlet"
});
if (y === "" || m === "")
$('#calendar').fullCalendar('today');
else
$('#calendar').fullCalendar('gotoDate', (y+'-'+m));
});
</script>
<div id="calendar"></div>
这里的问题是日历没有显示任何事件。我遵循和(这是指我链接的教程),但我似乎无法让它工作。日历在那里,但没有活动。我可以通过单击日历或编辑.jsp中的数组手动添加事件,但我希望它从数据库生成事件
<form name="choose" method="POST">
<table class="centerTable">
<tr>
<td>Month</td>
<td>:</td>
<td>
<select name="month" style="width:130px" required>
<option value="">Select a month:</option>
<option value="${01}" ${param.month == 01 ? 'selected' : ''}>January</option>
<option value="${02}" ${param.month == 02 ? 'selected' : ''}>February</option>
<option value="${03}" ${param.month == 03 ? 'selected' : ''}>March</option>
<option value="${04}" ${param.month == 04 ? 'selected' : ''}>April</option>
<option value="${05}" ${param.month == 05 ? 'selected' : ''}>May</option>
<option value="${06}" ${param.month == 06 ? 'selected' : ''}>June</option>
<option value="${07}" ${param.month == 07 ? 'selected' : ''}>July</option>
<option value="${08}" ${param.month == 08 ? 'selected' : ''}>August</option>
<option value="${09}" ${param.month == 09 ? 'selected' : ''}>September</option>
<option value="${10}" ${param.month == 10 ? 'selected' : ''}>October</option>
<option value="${11}" ${param.month == 11 ? 'selected' : ''}>November</option>
<option value="${12}" ${param.month == 12 ? 'selected' : ''}>December</option>
</select>
</td>
</tr>
<tr>
<td>Year</td>
<td>:</td>
<td>
<select name="year" style="width:130px" required>
<option value="">Select a year:</option>
<option value="${2016}" ${param.year == '2016' ? 'selected' : ''}>2016</option>
<option value="${2015}" ${param.year == '2015' ? 'selected' : ''}>2015</option>
<option value="${2014}" ${param.year == '2014' ? 'selected' : ''}>2014</option>
<option value="${2013}" ${param.year == '2013' ? 'selected' : ''}>2013</option>
<option value="${2012}" ${param.year == '2012' ? 'selected' : ''}>2012</option>
</select>
</td>
</tr>
<tr>
<td colspan=3 align=center>
<input type="submit" name="submit" value="Submit" onChange="submit();return false;">
</td>
</tr>
</table>
</form>
<script>
var y = "${param.year}";
var m = "${param.month}";
$(document).ready(function() {
$('#calendar').fullCalendar({
selectable: true,
selectHelper: true,
select: function(start, end) {
var title = prompt('Event Title:');
var eventData;
if (title) {
eventData = {
title: title,
start: start,
end: end
};
$('#calendar').fullCalendar('renderEvent', eventData, true);
}
$('#calendar').fullCalendar('unselect');
},
editable: true,
eventLimit: true,
events: "/Leave/KServlet"
});
if (y === "" || m === "")
$('#calendar').fullCalendar('today');
else
$('#calendar').fullCalendar('gotoDate', (y+'-'+m));
});
</script>
<div id="calendar"></div>
这是我的代码:
<form name="choose" method="POST">
<table class="centerTable">
<tr>
<td>Month</td>
<td>:</td>
<td>
<select name="month" style="width:130px" required>
<option value="">Select a month:</option>
<option value="${01}" ${param.month == 01 ? 'selected' : ''}>January</option>
<option value="${02}" ${param.month == 02 ? 'selected' : ''}>February</option>
<option value="${03}" ${param.month == 03 ? 'selected' : ''}>March</option>
<option value="${04}" ${param.month == 04 ? 'selected' : ''}>April</option>
<option value="${05}" ${param.month == 05 ? 'selected' : ''}>May</option>
<option value="${06}" ${param.month == 06 ? 'selected' : ''}>June</option>
<option value="${07}" ${param.month == 07 ? 'selected' : ''}>July</option>
<option value="${08}" ${param.month == 08 ? 'selected' : ''}>August</option>
<option value="${09}" ${param.month == 09 ? 'selected' : ''}>September</option>
<option value="${10}" ${param.month == 10 ? 'selected' : ''}>October</option>
<option value="${11}" ${param.month == 11 ? 'selected' : ''}>November</option>
<option value="${12}" ${param.month == 12 ? 'selected' : ''}>December</option>
</select>
</td>
</tr>
<tr>
<td>Year</td>
<td>:</td>
<td>
<select name="year" style="width:130px" required>
<option value="">Select a year:</option>
<option value="${2016}" ${param.year == '2016' ? 'selected' : ''}>2016</option>
<option value="${2015}" ${param.year == '2015' ? 'selected' : ''}>2015</option>
<option value="${2014}" ${param.year == '2014' ? 'selected' : ''}>2014</option>
<option value="${2013}" ${param.year == '2013' ? 'selected' : ''}>2013</option>
<option value="${2012}" ${param.year == '2012' ? 'selected' : ''}>2012</option>
</select>
</td>
</tr>
<tr>
<td colspan=3 align=center>
<input type="submit" name="submit" value="Submit" onChange="submit();return false;">
</td>
</tr>
</table>
</form>
<script>
var y = "${param.year}";
var m = "${param.month}";
$(document).ready(function() {
$('#calendar').fullCalendar({
selectable: true,
selectHelper: true,
select: function(start, end) {
var title = prompt('Event Title:');
var eventData;
if (title) {
eventData = {
title: title,
start: start,
end: end
};
$('#calendar').fullCalendar('renderEvent', eventData, true);
}
$('#calendar').fullCalendar('unselect');
},
editable: true,
eventLimit: true,
events: "/Leave/KServlet"
});
if (y === "" || m === "")
$('#calendar').fullCalendar('today');
else
$('#calendar').fullCalendar('gotoDate', (y+'-'+m));
});
</script>
<div id="calendar"></div>
main.jsp
<form name="choose" method="POST">
<table class="centerTable">
<tr>
<td>Month</td>
<td>:</td>
<td>
<select name="month" style="width:130px" required>
<option value="">Select a month:</option>
<option value="${01}" ${param.month == 01 ? 'selected' : ''}>January</option>
<option value="${02}" ${param.month == 02 ? 'selected' : ''}>February</option>
<option value="${03}" ${param.month == 03 ? 'selected' : ''}>March</option>
<option value="${04}" ${param.month == 04 ? 'selected' : ''}>April</option>
<option value="${05}" ${param.month == 05 ? 'selected' : ''}>May</option>
<option value="${06}" ${param.month == 06 ? 'selected' : ''}>June</option>
<option value="${07}" ${param.month == 07 ? 'selected' : ''}>July</option>
<option value="${08}" ${param.month == 08 ? 'selected' : ''}>August</option>
<option value="${09}" ${param.month == 09 ? 'selected' : ''}>September</option>
<option value="${10}" ${param.month == 10 ? 'selected' : ''}>October</option>
<option value="${11}" ${param.month == 11 ? 'selected' : ''}>November</option>
<option value="${12}" ${param.month == 12 ? 'selected' : ''}>December</option>
</select>
</td>
</tr>
<tr>
<td>Year</td>
<td>:</td>
<td>
<select name="year" style="width:130px" required>
<option value="">Select a year:</option>
<option value="${2016}" ${param.year == '2016' ? 'selected' : ''}>2016</option>
<option value="${2015}" ${param.year == '2015' ? 'selected' : ''}>2015</option>
<option value="${2014}" ${param.year == '2014' ? 'selected' : ''}>2014</option>
<option value="${2013}" ${param.year == '2013' ? 'selected' : ''}>2013</option>
<option value="${2012}" ${param.year == '2012' ? 'selected' : ''}>2012</option>
</select>
</td>
</tr>
<tr>
<td colspan=3 align=center>
<input type="submit" name="submit" value="Submit" onChange="submit();return false;">
</td>
</tr>
</table>
</form>
<script>
var y = "${param.year}";
var m = "${param.month}";
$(document).ready(function() {
$('#calendar').fullCalendar({
selectable: true,
selectHelper: true,
select: function(start, end) {
var title = prompt('Event Title:');
var eventData;
if (title) {
eventData = {
title: title,
start: start,
end: end
};
$('#calendar').fullCalendar('renderEvent', eventData, true);
}
$('#calendar').fullCalendar('unselect');
},
editable: true,
eventLimit: true,
events: "/Leave/KServlet"
});
if (y === "" || m === "")
$('#calendar').fullCalendar('today');
else
$('#calendar').fullCalendar('gotoDate', (y+'-'+m));
});
</script>
<div id="calendar"></div>
课堂上还有日历。它包含标题、开始、结束、颜色和文本颜色。所有变量都是字符串,并具有各自的setter和getter
<form name="choose" method="POST">
<table class="centerTable">
<tr>
<td>Month</td>
<td>:</td>
<td>
<select name="month" style="width:130px" required>
<option value="">Select a month:</option>
<option value="${01}" ${param.month == 01 ? 'selected' : ''}>January</option>
<option value="${02}" ${param.month == 02 ? 'selected' : ''}>February</option>
<option value="${03}" ${param.month == 03 ? 'selected' : ''}>March</option>
<option value="${04}" ${param.month == 04 ? 'selected' : ''}>April</option>
<option value="${05}" ${param.month == 05 ? 'selected' : ''}>May</option>
<option value="${06}" ${param.month == 06 ? 'selected' : ''}>June</option>
<option value="${07}" ${param.month == 07 ? 'selected' : ''}>July</option>
<option value="${08}" ${param.month == 08 ? 'selected' : ''}>August</option>
<option value="${09}" ${param.month == 09 ? 'selected' : ''}>September</option>
<option value="${10}" ${param.month == 10 ? 'selected' : ''}>October</option>
<option value="${11}" ${param.month == 11 ? 'selected' : ''}>November</option>
<option value="${12}" ${param.month == 12 ? 'selected' : ''}>December</option>
</select>
</td>
</tr>
<tr>
<td>Year</td>
<td>:</td>
<td>
<select name="year" style="width:130px" required>
<option value="">Select a year:</option>
<option value="${2016}" ${param.year == '2016' ? 'selected' : ''}>2016</option>
<option value="${2015}" ${param.year == '2015' ? 'selected' : ''}>2015</option>
<option value="${2014}" ${param.year == '2014' ? 'selected' : ''}>2014</option>
<option value="${2013}" ${param.year == '2013' ? 'selected' : ''}>2013</option>
<option value="${2012}" ${param.year == '2012' ? 'selected' : ''}>2012</option>
</select>
</td>
</tr>
<tr>
<td colspan=3 align=center>
<input type="submit" name="submit" value="Submit" onChange="submit();return false;">
</td>
</tr>
</table>
</form>
<script>
var y = "${param.year}";
var m = "${param.month}";
$(document).ready(function() {
$('#calendar').fullCalendar({
selectable: true,
selectHelper: true,
select: function(start, end) {
var title = prompt('Event Title:');
var eventData;
if (title) {
eventData = {
title: title,
start: start,
end: end
};
$('#calendar').fullCalendar('renderEvent', eventData, true);
}
$('#calendar').fullCalendar('unselect');
},
editable: true,
eventLimit: true,
events: "/Leave/KServlet"
});
if (y === "" || m === "")
$('#calendar').fullCalendar('today');
else
$('#calendar').fullCalendar('gotoDate', (y+'-'+m));
});
</script>
<div id="calendar"></div>
servlet在web.xml中正确映射,Netbeans不会输出任何错误
<form name="choose" method="POST">
<table class="centerTable">
<tr>
<td>Month</td>
<td>:</td>
<td>
<select name="month" style="width:130px" required>
<option value="">Select a month:</option>
<option value="${01}" ${param.month == 01 ? 'selected' : ''}>January</option>
<option value="${02}" ${param.month == 02 ? 'selected' : ''}>February</option>
<option value="${03}" ${param.month == 03 ? 'selected' : ''}>March</option>
<option value="${04}" ${param.month == 04 ? 'selected' : ''}>April</option>
<option value="${05}" ${param.month == 05 ? 'selected' : ''}>May</option>
<option value="${06}" ${param.month == 06 ? 'selected' : ''}>June</option>
<option value="${07}" ${param.month == 07 ? 'selected' : ''}>July</option>
<option value="${08}" ${param.month == 08 ? 'selected' : ''}>August</option>
<option value="${09}" ${param.month == 09 ? 'selected' : ''}>September</option>
<option value="${10}" ${param.month == 10 ? 'selected' : ''}>October</option>
<option value="${11}" ${param.month == 11 ? 'selected' : ''}>November</option>
<option value="${12}" ${param.month == 12 ? 'selected' : ''}>December</option>
</select>
</td>
</tr>
<tr>
<td>Year</td>
<td>:</td>
<td>
<select name="year" style="width:130px" required>
<option value="">Select a year:</option>
<option value="${2016}" ${param.year == '2016' ? 'selected' : ''}>2016</option>
<option value="${2015}" ${param.year == '2015' ? 'selected' : ''}>2015</option>
<option value="${2014}" ${param.year == '2014' ? 'selected' : ''}>2014</option>
<option value="${2013}" ${param.year == '2013' ? 'selected' : ''}>2013</option>
<option value="${2012}" ${param.year == '2012' ? 'selected' : ''}>2012</option>
</select>
</td>
</tr>
<tr>
<td colspan=3 align=center>
<input type="submit" name="submit" value="Submit" onChange="submit();return false;">
</td>
</tr>
</table>
</form>
<script>
var y = "${param.year}";
var m = "${param.month}";
$(document).ready(function() {
$('#calendar').fullCalendar({
selectable: true,
selectHelper: true,
select: function(start, end) {
var title = prompt('Event Title:');
var eventData;
if (title) {
eventData = {
title: title,
start: start,
end: end
};
$('#calendar').fullCalendar('renderEvent', eventData, true);
}
$('#calendar').fullCalendar('unselect');
},
editable: true,
eventLimit: true,
events: "/Leave/KServlet"
});
if (y === "" || m === "")
$('#calendar').fullCalendar('today');
else
$('#calendar').fullCalendar('gotoDate', (y+'-'+m));
});
</script>
<div id="calendar"></div>
然而,从Chrome控制台中,我可以看到KServlet返回了一个只有“[]”的空白页面。我猜我搞错了servlet中的某些内容,但我不确定是什么
<form name="choose" method="POST">
<table class="centerTable">
<tr>
<td>Month</td>
<td>:</td>
<td>
<select name="month" style="width:130px" required>
<option value="">Select a month:</option>
<option value="${01}" ${param.month == 01 ? 'selected' : ''}>January</option>
<option value="${02}" ${param.month == 02 ? 'selected' : ''}>February</option>
<option value="${03}" ${param.month == 03 ? 'selected' : ''}>March</option>
<option value="${04}" ${param.month == 04 ? 'selected' : ''}>April</option>
<option value="${05}" ${param.month == 05 ? 'selected' : ''}>May</option>
<option value="${06}" ${param.month == 06 ? 'selected' : ''}>June</option>
<option value="${07}" ${param.month == 07 ? 'selected' : ''}>July</option>
<option value="${08}" ${param.month == 08 ? 'selected' : ''}>August</option>
<option value="${09}" ${param.month == 09 ? 'selected' : ''}>September</option>
<option value="${10}" ${param.month == 10 ? 'selected' : ''}>October</option>
<option value="${11}" ${param.month == 11 ? 'selected' : ''}>November</option>
<option value="${12}" ${param.month == 12 ? 'selected' : ''}>December</option>
</select>
</td>
</tr>
<tr>
<td>Year</td>
<td>:</td>
<td>
<select name="year" style="width:130px" required>
<option value="">Select a year:</option>
<option value="${2016}" ${param.year == '2016' ? 'selected' : ''}>2016</option>
<option value="${2015}" ${param.year == '2015' ? 'selected' : ''}>2015</option>
<option value="${2014}" ${param.year == '2014' ? 'selected' : ''}>2014</option>
<option value="${2013}" ${param.year == '2013' ? 'selected' : ''}>2013</option>
<option value="${2012}" ${param.year == '2012' ? 'selected' : ''}>2012</option>
</select>
</td>
</tr>
<tr>
<td colspan=3 align=center>
<input type="submit" name="submit" value="Submit" onChange="submit();return false;">
</td>
</tr>
</table>
</form>
<script>
var y = "${param.year}";
var m = "${param.month}";
$(document).ready(function() {
$('#calendar').fullCalendar({
selectable: true,
selectHelper: true,
select: function(start, end) {
var title = prompt('Event Title:');
var eventData;
if (title) {
eventData = {
title: title,
start: start,
end: end
};
$('#calendar').fullCalendar('renderEvent', eventData, true);
}
$('#calendar').fullCalendar('unselect');
},
editable: true,
eventLimit: true,
events: "/Leave/KServlet"
});
if (y === "" || m === "")
$('#calendar').fullCalendar('today');
else
$('#calendar').fullCalendar('gotoDate', (y+'-'+m));
});
</script>
<div id="calendar"></div>
我真的很感谢任何能帮助我的人。多亏了阿文德和飓风,我现在成功地让它工作了。除了糟糕的SQL语句外,javascript导入的安排和不合适的数据类型(字符串而不是int)也是造成问题的原因
<form name="choose" method="POST">
<table class="centerTable">
<tr>
<td>Month</td>
<td>:</td>
<td>
<select name="month" style="width:130px" required>
<option value="">Select a month:</option>
<option value="${01}" ${param.month == 01 ? 'selected' : ''}>January</option>
<option value="${02}" ${param.month == 02 ? 'selected' : ''}>February</option>
<option value="${03}" ${param.month == 03 ? 'selected' : ''}>March</option>
<option value="${04}" ${param.month == 04 ? 'selected' : ''}>April</option>
<option value="${05}" ${param.month == 05 ? 'selected' : ''}>May</option>
<option value="${06}" ${param.month == 06 ? 'selected' : ''}>June</option>
<option value="${07}" ${param.month == 07 ? 'selected' : ''}>July</option>
<option value="${08}" ${param.month == 08 ? 'selected' : ''}>August</option>
<option value="${09}" ${param.month == 09 ? 'selected' : ''}>September</option>
<option value="${10}" ${param.month == 10 ? 'selected' : ''}>October</option>
<option value="${11}" ${param.month == 11 ? 'selected' : ''}>November</option>
<option value="${12}" ${param.month == 12 ? 'selected' : ''}>December</option>
</select>
</td>
</tr>
<tr>
<td>Year</td>
<td>:</td>
<td>
<select name="year" style="width:130px" required>
<option value="">Select a year:</option>
<option value="${2016}" ${param.year == '2016' ? 'selected' : ''}>2016</option>
<option value="${2015}" ${param.year == '2015' ? 'selected' : ''}>2015</option>
<option value="${2014}" ${param.year == '2014' ? 'selected' : ''}>2014</option>
<option value="${2013}" ${param.year == '2013' ? 'selected' : ''}>2013</option>
<option value="${2012}" ${param.year == '2012' ? 'selected' : ''}>2012</option>
</select>
</td>
</tr>
<tr>
<td colspan=3 align=center>
<input type="submit" name="submit" value="Submit" onChange="submit();return false;">
</td>
</tr>
</table>
</form>
<script>
var y = "${param.year}";
var m = "${param.month}";
$(document).ready(function() {
$('#calendar').fullCalendar({
selectable: true,
selectHelper: true,
select: function(start, end) {
var title = prompt('Event Title:');
var eventData;
if (title) {
eventData = {
title: title,
start: start,
end: end
};
$('#calendar').fullCalendar('renderEvent', eventData, true);
}
$('#calendar').fullCalendar('unselect');
},
editable: true,
eventLimit: true,
events: "/Leave/KServlet"
});
if (y === "" || m === "")
$('#calendar').fullCalendar('today');
else
$('#calendar').fullCalendar('gotoDate', (y+'-'+m));
});
</script>
<div id="calendar"></div>
我已经编辑了我的脚本,以防有人想用它作为指导多亏了阿文德和飓风,我现在才设法让它工作起来。除了糟糕的SQL语句外,javascript导入的安排和不合适的数据类型(字符串而不是int)也是造成问题的原因
<form name="choose" method="POST">
<table class="centerTable">
<tr>
<td>Month</td>
<td>:</td>
<td>
<select name="month" style="width:130px" required>
<option value="">Select a month:</option>
<option value="${01}" ${param.month == 01 ? 'selected' : ''}>January</option>
<option value="${02}" ${param.month == 02 ? 'selected' : ''}>February</option>
<option value="${03}" ${param.month == 03 ? 'selected' : ''}>March</option>
<option value="${04}" ${param.month == 04 ? 'selected' : ''}>April</option>
<option value="${05}" ${param.month == 05 ? 'selected' : ''}>May</option>
<option value="${06}" ${param.month == 06 ? 'selected' : ''}>June</option>
<option value="${07}" ${param.month == 07 ? 'selected' : ''}>July</option>
<option value="${08}" ${param.month == 08 ? 'selected' : ''}>August</option>
<option value="${09}" ${param.month == 09 ? 'selected' : ''}>September</option>
<option value="${10}" ${param.month == 10 ? 'selected' : ''}>October</option>
<option value="${11}" ${param.month == 11 ? 'selected' : ''}>November</option>
<option value="${12}" ${param.month == 12 ? 'selected' : ''}>December</option>
</select>
</td>
</tr>
<tr>
<td>Year</td>
<td>:</td>
<td>
<select name="year" style="width:130px" required>
<option value="">Select a year:</option>
<option value="${2016}" ${param.year == '2016' ? 'selected' : ''}>2016</option>
<option value="${2015}" ${param.year == '2015' ? 'selected' : ''}>2015</option>
<option value="${2014}" ${param.year == '2014' ? 'selected' : ''}>2014</option>
<option value="${2013}" ${param.year == '2013' ? 'selected' : ''}>2013</option>
<option value="${2012}" ${param.year == '2012' ? 'selected' : ''}>2012</option>
</select>
</td>
</tr>
<tr>
<td colspan=3 align=center>
<input type="submit" name="submit" value="Submit" onChange="submit();return false;">
</td>
</tr>
</table>
</form>
<script>
var y = "${param.year}";
var m = "${param.month}";
$(document).ready(function() {
$('#calendar').fullCalendar({
selectable: true,
selectHelper: true,
select: function(start, end) {
var title = prompt('Event Title:');
var eventData;
if (title) {
eventData = {
title: title,
start: start,
end: end
};
$('#calendar').fullCalendar('renderEvent', eventData, true);
}
$('#calendar').fullCalendar('unselect');
},
editable: true,
eventLimit: true,
events: "/Leave/KServlet"
});
if (y === "" || m === "")
$('#calendar').fullCalendar('today');
else
$('#calendar').fullCalendar('gotoDate', (y+'-'+m));
});
</script>
<div id="calendar"></div>
我已经编辑了我的脚本,以防有人想将其用作指南您是否检查了网络选项卡中的bowser控制台中的ajax调用?另外,在
KServlet.java
上放置一些断点,我已经检查过了,KServlet只返回一个带有“[]”的页面。我不确定在哪里放置断点,所以我只选择了“Any XHR”。请首先在ResultSet rs=stmt.executeQuery(query)
和l.add(c)
处使用paramsPut断点检查sql。另外,在调试模式下启动服务器。@据我所知,SQL并没有任何问题。我甚至尝试了一个简单的语句,比如“从LV_INFO_视图中选择人名,其中from_DATE='2015-04-10'”,Netbeans在其数据库管理器中无误地输出结果,但serlvet仍然返回一个空白列表“[]”。您是否检查了网络选项卡中的bowser控制台中的ajax调用?另外,在KServlet.java
上放置一些断点,我已经检查过了,KServlet只返回一个带有“[]”的页面。我不确定在哪里放置断点,所以我只选择了“Any XHR”。请首先在ResultSet rs=stmt.executeQuery(query)
和l.add(c)
处使用paramsPut断点检查sql。另外,在调试模式下启动服务器。@据我所知,SQL并没有任何问题。我甚至尝试了一个简单的语句,比如“从LV_INFO_视图中选择人名,其中from_DATE='2015-04-10'”,Netbeans在其数据库管理器中无误地输出结果,但serlvet仍然返回一个空白列表“[]”。
<form name="choose" method="POST">
<table class="centerTable">
<tr>
<td>Month</td>
<td>:</td>
<td>
<select name="month" style="width:130px" required>
<option value="">Select a month:</option>
<option value="${01}" ${param.month == 01 ? 'selected' : ''}>January</option>
<option value="${02}" ${param.month == 02 ? 'selected' : ''}>February</option>
<option value="${03}" ${param.month == 03 ? 'selected' : ''}>March</option>
<option value="${04}" ${param.month == 04 ? 'selected' : ''}>April</option>
<option value="${05}" ${param.month == 05 ? 'selected' : ''}>May</option>
<option value="${06}" ${param.month == 06 ? 'selected' : ''}>June</option>
<option value="${07}" ${param.month == 07 ? 'selected' : ''}>July</option>
<option value="${08}" ${param.month == 08 ? 'selected' : ''}>August</option>
<option value="${09}" ${param.month == 09 ? 'selected' : ''}>September</option>
<option value="${10}" ${param.month == 10 ? 'selected' : ''}>October</option>
<option value="${11}" ${param.month == 11 ? 'selected' : ''}>November</option>
<option value="${12}" ${param.month == 12 ? 'selected' : ''}>December</option>
</select>
</td>
</tr>
<tr>
<td>Year</td>
<td>:</td>
<td>
<select name="year" style="width:130px" required>
<option value="">Select a year:</option>
<option value="${2016}" ${param.year == '2016' ? 'selected' : ''}>2016</option>
<option value="${2015}" ${param.year == '2015' ? 'selected' : ''}>2015</option>
<option value="${2014}" ${param.year == '2014' ? 'selected' : ''}>2014</option>
<option value="${2013}" ${param.year == '2013' ? 'selected' : ''}>2013</option>
<option value="${2012}" ${param.year == '2012' ? 'selected' : ''}>2012</option>
</select>
</td>
</tr>
<tr>
<td colspan=3 align=center>
<input type="submit" name="submit" value="Submit" onChange="submit();return false;">
</td>
</tr>
</table>
</form>
<script>
var y = "${param.year}";
var m = "${param.month}";
$(document).ready(function() {
$('#calendar').fullCalendar({
selectable: true,
selectHelper: true,
select: function(start, end) {
var title = prompt('Event Title:');
var eventData;
if (title) {
eventData = {
title: title,
start: start,
end: end
};
$('#calendar').fullCalendar('renderEvent', eventData, true);
}
$('#calendar').fullCalendar('unselect');
},
editable: true,
eventLimit: true,
events: "/Leave/KServlet"
});
if (y === "" || m === "")
$('#calendar').fullCalendar('today');
else
$('#calendar').fullCalendar('gotoDate', (y+'-'+m));
});
</script>
<div id="calendar"></div>