在我的jsp页面中 迭代按钮//让我把迭代上的两个按钮
<s:iterator value="%{#session.allrefrence}">
<button class="btn " style=" background: #DB7093;color: white; " id="ref" value="%{refrenceid}" ></button>
</s:iterator>
//点击按钮后,我会将其参考ID发送给控制器
<script type="text/javascript">
$(document).ready(function() {
$('#ref')
.click(
function() {
$('#calendar').fullCalendar({
header: {
left: 'title',
right: ' today prev,next'
},
defaultDate: new Date(),
editable: false,
dataType: 'json',
events: function(start, end, timezone, callback) {
$.ajax({
url: '/Management/Calenderpick',
data : {reffrenceid : $('#ref').val()},
});
success: function(data) {
var events = [];
events.push({
title: data.title,
start: data.start,
end: data.end
});
callback(events);
},
error: function(e, x, y) {
console.log(e);
console.log(x);
console.log(y);
}
}
});
});
});
</script>
This is my xml configuration
<action name="Studentleave"
class="com.sms.controller.calender.leave">
<result type="json">
<param name="root">calenderList</param>
</result>
</action>
我的动作类
private String title;
private String start;
private String end;
public String execute() {
title = "EventXYZ";
start = "2016-12-02";
end = "2016-12-03";
return SUCCESS;
}
//getters and setters
这段代码有什么问题我无法在我的日历中打印标题值,任何帮助都会很明显
答案 0 :(得分:0)
尝试此操作+从动作结果中删除所有<param name="root"></param>
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'title',
right: ' today prev,next'
},
defaultDate: '2016-09-06',
editable: false,
dataType: 'json',
events: function(start, end, timezone, callback) {
$.ajax({
url: '/Management/Calenderpick',
data: {
// data if you are passing
},
success: function(data) {
var events = [];
events.push({
title: data.title,
start: data.start,
end: data.end
});
callback(events);
},
error: function(e, x, y) {
console.log(e);
console.log(x);
console.log(y);
}
});
}
});
});