예제 #1
1
  @Override
  public void init() throws ServletException {
    // TODO Auto-generated method stub
    super.init();
    filePath = getServletContext().getRealPath("") + File.separator + "schedule.ics";
    try {
      ical.getProperties().add(new ProdId("-//Ben Fortuna//iCal4j 1.0//EN"));
      ical.getProperties().add(Version.VERSION_2_0);
      ical.getProperties().add(CalScale.GREGORIAN);
    } catch (Exception e) {
      System.out.println("iCalendar failed to import");
    }
    registry = TimeZoneRegistryFactory.getInstance().createRegistry();
    timezone = registry.getTimeZone("America/New_York");
    tz = timezone.getVTimeZone();

    try {
      // Register the driver.
      Class.forName("org.postgresql.Driver").newInstance();
    } catch (Exception e) {
      e.printStackTrace();
    }
    String url = "jdbc:postgresql://hopper.cs.wlu.edu/corsola";
    try {
      con = DriverManager.getConnection(url, "web", "");
    } catch (SQLException e) {
      e.printStackTrace();
    }
  }