COS315 Java Homework3
COS315 Java Homework3
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@SuppressWarnings("unused")
@Controller
@RequestMapping("/employee")
public class EmployeeController {
@Autowired
private EmployeeService employeeservice;
@RequestMapping(value="/listEmployees", method=RequestMethod.GET)
return "showListEmployees";
}
@RequestMapping(value="/addEmployee", method=RequestMethod.GET)
return "showAddEmployeeForm";
}
@RequestMapping(value="/addEmployeeSubmit", method=RequestMethod.POST)
/* Method to add submitted new employee details to database, and then redirect to
listEmployees */
return "redirect:/employee/listEmployees";
}
@RequestMapping(value="/detailsEmployee/{id}", method=RequestMethod.GET)
model.addAttribute("employee", employee);
return "showEmployeeDetails";