@RequestMapping("/home")
	public ModelAndView home(HttpServletRequest request) {
			HttpSession session = request.getSession();
			String currRole = session.getAttribute("currRole").toString();
			ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("spring-config.xml");
			if(currRole.equals("student"))
			{	
			System.out.println("Student role");
			ModelAndView mv = new ModelAndView("homepageStudent");				
			StudentsRegistrationDAO studentRegistrationDAO = ctx.getBean("studentsRegistrationDAO", StudentsRegistrationDAO.class);
			List<StudentRegistration> registeredCourseId = studentRegistrationDAO.getRegisteredCoursesForId(session.getAttribute("currEmail").toString());
			courseDAO courseD = ctx.getBean("courseDAO", courseDAO.class);
			List<CourseGrade> registeredCourses = new ArrayList<CourseGrade>();
			for(StudentRegistration sr:registeredCourseId ){
				CourseGrade courseGrades = new CourseGrade();
				Course courseInfo = courseD.getCourse(sr.getCourseID());
				courseGrades.setCourseId(courseInfo.getCourseId());
				courseGrades.setCourseName(courseInfo.getCourseName());
				courseGrades.setCourseCategory(courseInfo.getCourseCategory());
				courseGrades.setGrades(sr.getGrades());
				registeredCourses.add(courseGrades);
			}	
			mv.addObject("coursesList", registeredCourses);
			System.out.println("Added object courseList");
			return mv;
		}
		else if(currRole.equals("content manager")){
			System.out.println("CM role");
			ModelAndView mv = new ModelAndView("homepageCM");
			return mv;
		}
		else {
			System.out.println("Admin role");
			ModelAndView mv = new ModelAndView("homepageAdmin");
			ClassPathXmlApplicationContext obj = new ClassPathXmlApplicationContext("spring-config.xml");
			UserDAO usersDAO = obj.getBean("userDAO", UserDAO.class);
			List<User> studentList = usersDAO.getAllUsers();
			List<User> cmList = new ArrayList<User>();
			for (ListIterator<User> iter = studentList.listIterator(); iter.hasNext(); ) {
			    User element = iter.next();
			    if(element.getRole().equals("content manager"))
			    {
			    	cmList.add(element);
			    	iter.remove();
			    }
			    else if(element.getRole().equals("admin"))
			    {
			    	iter.remove();
			    }
			}
			System.out.println(studentList.size() + " content managers");
			System.out.println(cmList.size() + " students");
			mv.addObject("studentList", studentList);
			mv.addObject("cmList", cmList);
			return mv;
		}
		//System.out.println("From session: " + session.getAttribute("currRole"));		

		
	}