开发者

Events still not showing up despite the many tries...sigh

开发者 https://www.devze.com 2022-12-29 10:38 出处:网络
I have tried the recommendation from this forum and through the many google searches...but i still can\'t get the events to show up on my calendar via jsp....i tried with php and it worked...sigh...i

I have tried the recommendation from this forum and through the many google searches...but i still can't get the events to show up on my calendar via jsp....i tried with php and it worked...sigh...i wonder where is the error....sigh....

The processRequest method is fine but when it dispatches to the JSP page...nothing appears from the browser....

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) {
    }
}

Here is the JSP section that's giving me headaches...(Without the loop...the Google link does appear...)...I have tried putting quotations and leaving them out....still no luck:

<%--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.event开发者_Python百科Name}',
                                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--%>

...any kind of help would be greatly appreciated...thx!!


First you need to verify that the format is correct, and that jsp is outputting it correctly.

Perhaps create a dummy page, that just output's event data.

Also in your loop, not sure how you do it in JSP, but don't you need to not end with a comma, if your at the last item in the set of data?

Or maybe you can use your jsp to create a javascript array, that holds the data, that comes from JSP. then lower down, do the jQuery FullCalendar call, and pass that array full of data.

So you can either case, verify the correctness of the event data syntax/format and better ways to put the data inside the calendar call.

Good luck..

0

精彩评论

暂无评论...
验证码 换一张
取 消