2010-05-09 71 views
0

我已經嘗試了這個論壇的推薦以及通過很多谷歌搜索......但是我仍然無法通過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節竟然放棄了我頭疼......(不循環...的谷歌鏈接確實出現...)...我已經試過把引號放在外面......仍然沒有luc k:

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

...任何形式的幫助將不勝感激...... thx !!

回答

0

首先您需要驗證格式是否正確,並且jsp正確輸出。

也許創建一個虛擬頁面,即輸出的事件數據。

同樣在你的循環中,不確定你在JSP中如何做,但是如果你在數據集中的最後一項,你不需要以逗號結尾嗎?

或者,也許你可以使用你的jsp來創建一個JavaScript數組,它保存來自JSP的數據。然後降低,完成jQuery FullCalendar調用,並傳遞數組。

因此,無論是哪種情況,請驗證事件數據語法/格式的正確性以及將日曆調用中的數據置於更好的方式。

祝你好運..

+0

燁... THX ...我可以看到一些改變現在的日曆......除了事件日期JSP的調度後,無法解析servlet的字符串數據.... – user614454 2010-05-11 14:45:37

相關問題