@RequestMapping(value = "/login", method = RequestMethod.POST)
	public ModelAndView loginUser(@RequestParam String userId,
			@RequestParam String password, @RequestParam int department,
			HttpServletResponse response) {
		ModelAndView modelAndView = new ModelAndView();
		String result = service.login(userId, password, department);
		modelAndView.addObject("response", result);
		if (result.equals(ResponseMessages.LOGIN_SUCCESSFUL)) {
			response.addCookie(new Cookie("System-Cookie", RandomStringUtil
					.getRandomCookieValue()));
			Cookie userIdCookie = new Cookie("userid", userId);
			userIdCookie.setMaxAge(24 * 60 * 60);

			response.addCookie(userIdCookie);
			service.postLogin(userId, modelAndView);
			Employee employee = (Employee) modelAndView.getModelMap().get(
					"employee_details");
			Cookie userNameCookie = new Cookie("user_name",
					employee.getEmployeeName());
			Cookie managerCookie = new Cookie("manager_id",
					employee.getManagerId());
			managerCookie.setMaxAge(24 * 60 * 60);
			userIdCookie.setMaxAge(24 * 60 * 60);
			response.addCookie(userNameCookie);
			response.addCookie(managerCookie);
		}

		return modelAndView;
	}