	private void postAbsenceInfo(HttpServletRequest req,
			HttpServletResponse resp) throws ServletException, IOException {
		DataTrain train = DataTrain.depart();
		AbsenceManager ac = train.absences();
		DateTimeZone zone = train.appData().get().getTimeZone();
		boolean validForm = true;
		List<String> errors = new LinkedList<String>();
		if (!ValidationUtil.isPost(req)) {
			validForm = false;
		} else {
			String absid = req.getParameter("absenceid");
			if (req.getParameter("delete") != null) {
				deleteAbsence(absid, ac, req, resp);
				return;
			}
			long aid;
			Absence toUpdate = null;
			if (absid != null) {
				String type = req.getParameter("Type");
				String status = req.getParameter("Status");
				String eventid = req.getParameter("eventid");
				Event event = null;
				try {
					long eid = Long.parseLong(eventid);
					event = train.events().get(eid);
				} catch (NumberFormatException nfe) {
					errors.add("No event to add. Can't create absence.");
				}
				if (absid.equals("new")) {
					String sid = req.getParameter("studentid");
					User student = train.users().get(sid);
					Absence.Type atype = Absence.Type.valueOf(type);
					if (student != null) {
						DateTime time = Util.parseDateTime(
								req.getParameter("date") + " "
										+ req.getParameter("time"), train
										.appData().get().getTimeZone());
						switch (atype) {
						case Absence:
							toUpdate = ac.createOrUpdateAbsence(student, event);
							break;
						case Tardy:
							toUpdate = ac.createOrUpdateTardy(student, time);
							break;
						case EarlyCheckOut:
							toUpdate = ac.createOrUpdateEarlyCheckout(student,
									time);
							break;
						}
					}
				} else {
					aid = Long.parseLong(absid);
					toUpdate = ac.get(aid);
				}
				if (toUpdate != null) {
					try {
						LocalTime d = Util.parseTimeOnly(
								req.getParameter("time"), train.appData().get()
										.getTimeZone());
						switch (toUpdate.getType()) {
						case EarlyCheckOut:
							toUpdate.setCheckout(d.toDateTime(toUpdate
									.getCheckout(zone).toDateMidnight()));
							break;
						case Tardy:
							toUpdate.setCheckin(d.toDateTime(toUpdate
									.getCheckin(zone).toDateMidnight()));
							break;
						default:
							throw new IllegalStateException();
						}
						toUpdate.setType(Absence.Type.valueOf(type));
						toUpdate.setStatus(Absence.Status.valueOf(status));
					} catch (ValidationExceptions e) {
						validForm = false;
						errors.add("Invalid Input: The input DateTime was invalid.");
					} catch (IllegalArgumentException e) {
						validForm = false;
						errors.add("Invalid Input: The input DateTime is invalid.");
					} catch (IllegalStateException e) {
						validForm = false;
						errors.add("Invalid Input: Cannot set time for absence");
					}
				} else {
					validForm = false;
					errors.add("Could not find the Absence to update");
				}
			} else {
				validForm = false;
				errors.add("Could not find the Absence to update");
			}
			if (validForm) {
				ac.updateAbsence(toUpdate);
				viewAbsence(req, resp, errors, "Successfully updated absence");
			} else {
				viewAbsence(req, resp, errors, "");
			}
		}
	}

	private void postAbsenceInfo(HttpServletRequest req,
			HttpServletResponse resp) throws ServletException, IOException {
		DataTrain train = DataTrain.depart();
		AbsenceManager ac = train.absences();
		DateTimeZone zone = train.appData().get().getTimeZone();
		boolean validForm = true;
		List<String> errors = new LinkedList<String>();
		if (!ValidationUtil.isPost(req)) {
			validForm = false;
		} else {
			String absid = req.getParameter("absenceid");
			if (req.getParameter("delete") != null) {
				deleteAbsence(absid, ac, req, resp);
				return;
			}
			long aid;
			Absence toUpdate = null;
			if (absid != null) {
				String type = req.getParameter("Type");
				String status = req.getParameter("Status");
				String eventid = req.getParameter("eventid");
				Event event = null;
				try {
					long eid = Long.parseLong(eventid);
					event = train.events().get(eid);
				} catch (NumberFormatException nfe) {
					errors.add("No event to add. Can't create absence.");
				}
				if (absid.equals("new")) {
					String sid = req.getParameter("studentid");
					User student = train.users().get(sid);
					Absence.Type atype = Absence.Type.valueOf(type);
					if (student != null) {
						DateTime time = Util.parseDateTime(
								req.getParameter("date") + " "
										+ req.getParameter("time"), train
										.appData().get().getTimeZone());
						switch (atype) {
						case Absence:
							toUpdate = ac.createOrUpdateAbsence(student, event);
							break;
						case Tardy:
							toUpdate = ac.createOrUpdateTardy(student, time);
							break;
						case EarlyCheckOut:
							toUpdate = ac.createOrUpdateEarlyCheckout(student,
									time);
							break;
						}
					}
				} else {
					aid = Long.parseLong(absid);
					toUpdate = ac.get(aid);
				}
				if (toUpdate != null) {
					try {
						String time = req.getParameter("time");
						LocalTime d = null;
						if (time != null && !time.equals("")) {
							d = Util.parseTimeOnly(time, train.appData().get()
									.getTimeZone());
						}
						if (d == null
								&& toUpdate.getType() != Absence.Type.Absence) {
							throw new IllegalArgumentException();
						}
						switch (toUpdate.getType()) {
						case EarlyCheckOut:
							toUpdate.setCheckout(d.toDateTime(toUpdate
									.getCheckout(zone).toDateMidnight()));
							break;
						case Tardy:
							toUpdate.setCheckin(d.toDateTime(toUpdate
									.getCheckin(zone).toDateMidnight()));
							break;
						case Absence:
							break;
						default:
							throw new IllegalStateException();
						}
						toUpdate.setType(Absence.Type.valueOf(type));
						toUpdate.setStatus(Absence.Status.valueOf(status));
					} catch (ValidationExceptions e) {
						validForm = false;
						errors.add("Invalid Input: The input DateTime was invalid.");
					} catch (IllegalArgumentException e) {
						validForm = false;
						errors.add("Invalid Input: The input DateTime is invalid.");
					} catch (IllegalStateException e) {
						validForm = false;
						errors.add("Invalid Input: Cannot set time for absence");
					}
				} else {
					validForm = false;
					errors.add("Could not find the Absence to update");
				}
			} else {
				validForm = false;
				errors.add("Could not find the Absence to update");
			}
			if (validForm) {
				ac.updateAbsence(toUpdate);
				viewAbsence(req, resp, errors, "Successfully updated absence");
			} else {
				viewAbsence(req, resp, errors, "");
			}
		}
	}
