views:

96

answers:

1

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.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--%>

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

A: 

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..

crosenblum
Yup...thx...i can see some changes to the calendar now...except the event date cannot parse servlet's String data after the JSP's dispatch....