I am having problems with adding a servlet to a program that I have written previously. Its not the servlet that is throwing me for a loop, its when I need to check to see if the appointment I am adding to the list is the same time as another appointment in the list.

Here is what I want to do, just so you know.

Have the user enter the information for one appointment and add it to the list, if that time is available.

Show the results.

If the date/time is unavailable, redirect to an error JSP.
You will notice in my ApptServlet.java, I have commented out a few lines of code related to the checking to see if the date is taken or not.

Code:
			if(pl.isTaken(appt))
			{
				RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/Error.jsp");
				dispatcher.forward(request, response);
			}//end if
			else
			{
				List plist = pl.getPatientList();
				request.setAttribute("plist",plist);
				RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/Results.jsp");
				dispatcher.forward(request, response);
			}//end else
What I want to do is, in the ApptServlet.java if the date is taken, redirect to the Error.jsp. Else, set the patientList to the request object then redirect to the Results.jsp.

I am trying to use an If Else statement to sort this out. I am using a method called isTaken() that checks the date of the appointment object that I want to add to the list against the dates of the appointment objects already in the list.

The problem is I dont know how I should this in the following method. If the date is taken, I want to redirect to the error.jsp, but how would I do that.

Code:
	public void setAppointments(String n, int pID, boolean apptReason, int year, int month, int date, int hourOfDay, int minute)
	{
		//Create an new appointment object then add the appointment to the list
		Appointment appt = new Appointment(n, pID, apptReason, year, month, date, hourOfDay, minute);
		
		//check to see if the appointments date = the date of another appointment
		//Can I do something to foward the request dispatcher here if I extend HTTPServlet?
		if(pl.isTaken(appt))
		{
		//I want to redirect to the error.jsp
		}
		else
		{
			patientList.add(appt);
		}
	}
I have included my full code in a zip file.