diff --git a/src/main/java/org/springframework/samples/petclinic/web/ClinicController.java b/src/main/java/org/springframework/samples/petclinic/web/ClinicController.java index e93ae8f66..fa9f092c1 100644 --- a/src/main/java/org/springframework/samples/petclinic/web/ClinicController.java +++ b/src/main/java/org/springframework/samples/petclinic/web/ClinicController.java @@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.samples.petclinic.Clinic; import org.springframework.samples.petclinic.Vets; import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @@ -54,10 +55,11 @@ public class ClinicController { * @return a ModelMap with the model attributes for the view */ @RequestMapping("/vets") - public ModelMap vetsHandler() { + public String showVetList(Model model) { Vets vets = new Vets(); vets.getVetList().addAll(this.clinic.getVets()); - return new ModelMap(vets); + model.addAttribute("vets", vets); + return "vets"; } /** @@ -67,7 +69,7 @@ public class ClinicController { * @return a ModelMap with the model attributes for the view */ @RequestMapping("/owners/{ownerId}") - public ModelAndView ownerHandler(@PathVariable("ownerId") int ownerId) { + public ModelAndView showOwner(@PathVariable("ownerId") int ownerId) { ModelAndView mav = new ModelAndView("owners/show"); mav.addObject(this.clinic.loadOwner(ownerId)); return mav; diff --git a/src/main/webapp/WEB-INF/petclinic-servlet.xml b/src/main/webapp/WEB-INF/petclinic-servlet.xml index 345a2da8a..4c56a4236 100644 --- a/src/main/webapp/WEB-INF/petclinic-servlet.xml +++ b/src/main/webapp/WEB-INF/petclinic-servlet.xml @@ -5,7 +5,7 @@ @@ -30,7 +30,7 @@ - This bean processes annotated handler methods, applying PetClinic-specific PropertyEditors - for request parameter binding. It overrides the default AnnotationMethodHandlerAdapter. --> - + @@ -50,6 +50,7 @@ dataAccessFailure + - + + @@ -69,7 +71,8 @@ atom=application/atom+xml - xml=#{vets.contentType} + html=text/html + xml=application/xml @@ -77,11 +80,11 @@ - + + p:suffix=".jsp" /> - + + + diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index 768329b1b..43c322bd5 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -161,12 +161,6 @@ 10 - - java.lang.Exception - - /WEB-INF/jsp/uncaughtException.jsp - -