代码之家  ›  专栏  ›  技术社区  ›  user614454

尽管多次尝试,事件仍然没有出现…叹息

  •  0
  • user614454  · 技术社区  · 14 年前

    我试过这个论坛的推荐,也试过很多google搜索……但是我仍然无法通过jsp让事件显示在我的日历上……我试过php,结果成功了……唉……我想知道错误在哪里……唉……

    processrequest方法很好,但是当它发送到jsp页面时…浏览器中没有显示任何内容…

    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        String email=request.getParameter("email");
        try {
            ArrayList<CalendarEvt> calc=CalendarDAO.retrieveEvent(email);
            for (CalendarEvt calendarEvt : calc) {
                System.out.println(calendarEvt.getEventId());
            }
    
            request.setAttribute("calendar", calc);
            request.getRequestDispatcher("calendar.jsp").forward(request, response);
    
        } catch (Exception e) {
        }
    }
    

    这是让我头疼的jsp部分…(没有循环…google链接确实出现了…)…我试着把报价放在一边,但还是没有成功:

    <%--Load user's calendar--%>
            <script type='text/javascript'>
    
                $(document).ready(function() {
    
                    var date = new Date();
                    var d = date.getDate();
                    var m = date.getMonth();
                    var y = date.getFullYear();
    
                    $('#calendar').fullCalendar({
                        editable: false,
                        events: [
                <c:forEach items="calendar" var="calc">
                                {
                                    title: '${calc.eventName}',
                                    start: ${calc.eventStart}
    
                                },
                </c:forEach>
                                {
    
                                    title: 'Click for Google',
                                    start: new Date(y, m, 1),
                                    end: new Date(y, m, 1),
                                    url: 'http://google.com/'
                                }
    
    
    
                            ]//end of events
                        });
    
                    });
    
            </script>
    
            <%--Load user's calendar--%>
    

    …任何形式的帮助都会非常感谢…谢谢!!

    1 回复  |  直到 14 年前
        1
  •  0
  •   crosenblum    14 年前

    首先需要验证格式是否正确,以及jsp是否正确输出格式。

    也许创建一个虚拟页面,它只是输出事件数据。

    同样在您的循环中,不确定您在jsp中是如何做到的,但是如果您在数据集中的最后一项,您不需要以逗号结尾吗?

    或者您可以使用jsp创建一个javascript数组,它保存来自jsp的数据。然后向下执行jquery fullcalendar调用,并传递该数组中的所有数据。

    因此,无论哪种情况,都可以验证事件数据语法/格式的正确性,以及将数据放入日历调用中的更好方法。

    祝你好运。。