내용 |
package kr.co.javaspecialist.employees.web;
import java.util.List;
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;
import kr.co.javaspecialist.employees.model.EmpVO;
import kr.co.javaspecialist.employees.model.IEmpRepository;
@Controller
@RequestMapping("/emp")
public class EmpController {
@Autowired
IEmpRepository empRepository;
@RequestMapping("/list")
public String emplist(Model model) {
List<EmpVO> empList = empRepository.getEmpList();
model.addAttribute("emplist", empList);
return "emp/list";
}
@RequestMapping("/{employeeId}")
public String empDetails(@PathVariable int employeeId, Model model) {
EmpVO emp = empRepository.getEmpDetails(employeeId);
model.addAttribute("emp", emp);
return "emp/details";
}
}
|