diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml index 79f3a6e..7b47b1c 100644 --- a/nbproject/build-impl.xml +++ b/nbproject/build-impl.xml @@ -999,12 +999,14 @@ exists or setup the property manually. For example like this: + + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties index 05e0e0c..d543ac6 100644 --- a/nbproject/genfiles.properties +++ b/nbproject/genfiles.properties @@ -1,8 +1,8 @@ -build.xml.data.CRC32=93eaf31f +build.xml.data.CRC32=2b4716e4 build.xml.script.CRC32=4f7907cb build.xml.stylesheet.CRC32=651128d4@1.77.1.1 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=93eaf31f -nbproject/build-impl.xml.script.CRC32=e6ecef56 +nbproject/build-impl.xml.data.CRC32=2b4716e4 +nbproject/build-impl.xml.script.CRC32=9cf099e1 nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.77.1.1 diff --git a/nbproject/private/private.properties b/nbproject/private/private.properties index 1b8816d..eab390d 100644 --- a/nbproject/private/private.properties +++ b/nbproject/private/private.properties @@ -1,10 +1,10 @@ -deploy.ant.properties.file=C:\\Users\\AGS\\AppData\\Roaming\\NetBeans\\8.2\\tomcat80.properties +deploy.ant.properties.file=C:\\Users\\mufidjamaluddin\\AppData\\Roaming\\NetBeans\\8.2\\tomcat80.properties j2ee.platform.is.jsr109=true j2ee.server.domain=C:/Users/Maulana/AppData/Roaming/NetBeans/8.2/apache-tomcat-8.0.27.0_base -j2ee.server.home=D:/KULIAH/3RD SEMESTER/apache-tomcat-8.5.23-windows-x64/apache-tomcat-8.5.23 -j2ee.server.instance=tomcat80:home=D:\\KULIAH\\3RD SEMESTER\\apache-tomcat-8.5.23-windows-x64\\apache-tomcat-8.5.23 +j2ee.server.home=D:/xampp/tomcat +j2ee.server.instance=tomcat80:home=D:\\xampp\\tomcat j2ee.server.middleware=C:/Program Files/Glassfish/glassfish 4.1.1 javac.debug=true javadoc.preview=true selected.browser=SL[/Browsers/FirefoxBrowser -user.properties.file=C:\\Users\\Maulana\\AppData\\Roaming\\NetBeans\\8.2\\build.properties +user.properties.file=C:\\Users\\mufidjamaluddin\\AppData\\Roaming\\NetBeans\\8.2\\build.properties diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml index 88f5d18..284eeec 100644 --- a/nbproject/private/private.xml +++ b/nbproject/private/private.xml @@ -2,8 +2,6 @@ - - file:/E:/tugas%20kuliah/tingkat%202/github%20proyek%203/Travlendar/web/Admin-Panel/Teamplate/Header/header.jsp - + diff --git a/nbproject/project.properties b/nbproject/project.properties index 4f8cd05..4504f20 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -29,17 +29,19 @@ dist.war=${dist.dir}/${war.name} endorsed.classpath=\ ${libs.javaee-endorsed-api-7.0.classpath} excludes= +file.reference.java-json.jar=C:\\Users\\mufidjamaluddin\\Downloads\\java-json\\java-json.jar includes=** j2ee.compile.on.save=true j2ee.copy.static.files.on.save=true j2ee.deploy.on.save=true j2ee.platform=1.7-web -j2ee.platform.classpath=${j2ee.server.home}/lib/annotations-api.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/catalina-storeconfig.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/ecj-4.6.3.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/jaspic-api.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/tomcat-jni.jar:${j2ee.server.home}/lib/tomcat-util-scan.jar:${j2ee.server.home}/lib/tomcat-util.jar:${j2ee.server.home}/lib/tomcat-websocket.jar:${j2ee.server.home}/lib/websocket-api.jar +j2ee.platform.classpath=${j2ee.server.home}/lib/annotations-api.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/catalina-storeconfig.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/ecj-4.4.jar:${j2ee.server.home}/lib/ecj-4.6.3.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/jaspic-api.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/tomcat-jni.jar:${j2ee.server.home}/lib/tomcat-util-scan.jar:${j2ee.server.home}/lib/tomcat-util.jar:${j2ee.server.home}/lib/tomcat-websocket.jar:${j2ee.server.home}/lib/tomcat7-websocket.jar:${j2ee.server.home}/lib/websocket-api.jar j2ee.server.type=Tomcat jar.compress=false javac.classpath=\ ${libs.MySQLDriver.classpath}:\ - ${libs.jstl.classpath} + ${libs.jstl.classpath}:\ + ${file.reference.java-json.jar} # Space-separated list of extra javac options javac.compilerargs= javac.debug=true diff --git a/nbproject/project.xml b/nbproject/project.xml index 28e6fe9..a0e83ba 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -14,6 +14,10 @@ ${libs.jstl.classpath} WEB-INF/lib + + ${file.reference.java-json.jar} + WEB-INF/lib + diff --git a/src/java/id/ac/polban/jtk/project3/travlendar2A/Controller/EventController.java b/src/java/id/ac/polban/jtk/project3/travlendar2A/Controller/EventController.java index 7b2c925..870b699 100644 --- a/src/java/id/ac/polban/jtk/project3/travlendar2A/Controller/EventController.java +++ b/src/java/id/ac/polban/jtk/project3/travlendar2A/Controller/EventController.java @@ -25,6 +25,8 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.json.JSONException; +import org.json.JSONObject; @WebServlet(name = "event", urlPatterns = {"/Admin-Panel/event"}) /* URL Controllernya */ public class EventController extends HttpServlet @@ -87,6 +89,16 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t /* Jika isi parameter action itu show, maka tampilkan list moda kendaraan */ switch(action) { + case "calendar": + + try { + this.setAttrListJson(request); + } catch (JSONException ex) { + Logger.getLogger(EventController.class.getName()).log(Level.SEVERE, null, ex); + } + + request.getRequestDispatcher("CalendarEvent/index.jsp").forward(request, response); + break; case "show": // set httprequest atribut dengan list dari database this.setAttrList(request); @@ -302,6 +314,51 @@ private void setAttrList(HttpServletRequest request) request.setAttribute("eventList", listEvent); } + /** + * + * @param request + * @throws org.json.JSONException + */ + public void setAttrListJson(HttpServletRequest request) throws JSONException + { + List listEvent; + int page = 1; + JSONObject jsonObj; + + String pagestr = request.getParameter("page"); + + // Jika parameter page di set + if(pagestr != null) + { + page = Integer.parseInt(pagestr); + } + + try + { + listEvent = this.eventDAO.getListFromDB(page); + } + catch (SQLException ex) + { + // ex.printStackTrace(); + listEvent = null; + } + + if(listEvent != null) + { + jsonObj = new JSONObject(); + + for(Event objEvent : listEvent) + { + jsonObj.put("title", objEvent.getEvent_name()); + jsonObj.put("start", objEvent.getStart_event()); + jsonObj.put("end", objEvent.getEnd_event()); + } + // dikirimkan ke httprequest atribut + request.setAttribute("jsonList", jsonObj.toString()); + } + + } + /** * Method untuk menambahkan objek modatransportasi * ke httprequest diff --git a/src/java/id/ac/polban/jtk/project3/travlendar2A/Models/Event.java b/src/java/id/ac/polban/jtk/project3/travlendar2A/Models/Event.java index 70474f9..d9c9758 100644 --- a/src/java/id/ac/polban/jtk/project3/travlendar2A/Models/Event.java +++ b/src/java/id/ac/polban/jtk/project3/travlendar2A/Models/Event.java @@ -191,6 +191,16 @@ public int getLocation_id() { public void setLocation_id(int location_id) { this.location_id = location_id; } + + /** + * + * @return + */ + public String toStringJson() + { + return String.format("{ title: %s, start: %s, end: %s }", this.event_name, this.start_event, this.end_event); + } + } diff --git a/web/CalendarEvent/index.jsp b/web/CalendarEvent/index.jsp index e146c43..07aee0c 100644 --- a/web/CalendarEvent/index.jsp +++ b/web/CalendarEvent/index.jsp @@ -22,7 +22,7 @@