protected void processRequest(HttpServletRequest request, HttpServletResponse response)
	   			throws ServletException, IOException {
        
        	// CHANGE: The EJB is instantiated automatically
    		// CourseModel model = CourseModelImpl.getInstance();
		
		String path = request.getServletPath();
		if (path.equals("/StudentController")) {

		    String id = request.getParameter("studentId");
		    String name = request.getParameter("studentName");
		    String address = request.getParameter("studentAddress");
// ADD version parameter
		    int version = Integer.parseInt(request.getParameter("version"));
		    String submit = request.getParameter("submit");
		    try {
// MODIFY add version parameter
		        if (submit.equals("Get Student")) {
		            Student stud = model.getStudent(id);
		            request.setAttribute("student", stud);
		        } else if (submit.equals("Update Student")) {
		            model.updateStudent(new Student(id, name, address,version));
		            Student stud = model.getStudent(id);
		            request.setAttribute("student", stud);
		        } else if (submit.equals("Add Student")) {
		            model.addStudent(new Student(id, name, address, version));
		            Student stud = model.getStudent(id);
		            request.setAttribute("student", stud);
		        } else if (submit.equals("Delete Student")) {
		            model.deleteStudent(new Student(id, name, address, version));
		        }
		    } catch (CourseException ex) {
		        request.setAttribute("message", ex.getMessage());
		    }
		    RequestDispatcher dispatcher =
		    	request.getRequestDispatcher("StudentDetails");
		    	dispatcher.forward(request, response);
		} else if (path.equals("/AllStudents")) {

		    try {

		        Student[] students = model.getAllStudents();
		        request.setAttribute("students", students);

		    } catch (CourseException ex) {
		        request.setAttribute("message", ex.getMessage());
		    }

		    RequestDispatcher dispatcher = request.getRequestDispatcher("AllStudents.jsp");
		    dispatcher.forward(request, response);

		}
     }