我正在为JSF编写循环到javascript。 此代码块 标题:'#{userBean.userList [0] .name}' 正在运行,但我想在循环中使用。例如 title:'#{userBean.userList [i] .name}'
<script>
$(document).ready(function () {
var events = [];
for(var i =0; i < #{userBean.userList.size()}; i++)
{
events.push( {
title: '#{userBean.userList[i].name}',
start: new Date('#{userBean.userList[i].createDate}'),
end: new Date('#{userBean.userList[i].date}')
});
}
$('#calendar').fullCalendar({
defaultDate: new Date(),
editable: true,
eventLimit: true, // allow "more" link when too many events
events: events,
eventColor: '#3A87AD',
});
});
</script>