diff --git a/src/main/java/org/springframework/samples/petclinic/web/OwnerController.java b/src/main/java/org/springframework/samples/petclinic/web/OwnerController.java
index a7f760a97..a7fcfe4e4 100644
--- a/src/main/java/org/springframework/samples/petclinic/web/OwnerController.java
+++ b/src/main/java/org/springframework/samples/petclinic/web/OwnerController.java
@@ -22,7 +22,7 @@ import org.springframework.web.servlet.ModelAndView;
/**
* JavaBean form controller that is used to handle Owner
s .
- *
+ *
* @author Juergen Hoeller
* @author Ken Krebs
* @author Arjen Poutsma
@@ -63,7 +63,7 @@ public class OwnerController {
return "redirect:/owners/" + owner.getId();
}
}
-
+
@RequestMapping(value = "/owners/find", method = RequestMethod.GET)
public String initFindForm(Model model) {
model.addAttribute("owner", new Owner());
@@ -96,7 +96,7 @@ public class OwnerController {
return "redirect:/owners/" + owner.getId();
}
}
-
+
@RequestMapping(value="/owners/{ownerId}/edit", method = RequestMethod.GET)
public String initUpdateOwnerForm(@PathVariable("ownerId") int ownerId, Model model) {
Owner owner = this.ownerRepository.findById(ownerId);
@@ -112,10 +112,10 @@ public class OwnerController {
else {
this.ownerRepository.save(owner);
status.setComplete();
- return "redirect:/owners/" + owner.getId();
+ return "redirect:/owners/{ownerId}";
}
}
-
+
/**
* Custom handler for displaying an owner.
*
diff --git a/src/main/java/org/springframework/samples/petclinic/web/PetController.java b/src/main/java/org/springframework/samples/petclinic/web/PetController.java
index ad94356ac..810985a15 100644
--- a/src/main/java/org/springframework/samples/petclinic/web/PetController.java
+++ b/src/main/java/org/springframework/samples/petclinic/web/PetController.java
@@ -24,7 +24,7 @@ import org.springframework.web.bind.support.SessionStatus;
/**
* JavaBean form controller that is used to add a new Pet
to the
* system.
- *
+ *
* @author Juergen Hoeller
* @author Ken Krebs
* @author Arjen Poutsma
@@ -35,7 +35,7 @@ public class PetController {
private final ClinicService clinicService;
-
+
@Autowired
public PetController(ClinicService clinicService) {
this.clinicService = clinicService;
@@ -69,10 +69,10 @@ public class PetController {
else {
this.clinicService.savePet(pet);
status.setComplete();
- return "redirect:/owners/" + pet.getOwner().getId();
+ return "redirect:/owners/{ownerId}";
}
}
-
+
@RequestMapping(value="/owners/*/pets/{petId}/edit", method = RequestMethod.GET)
public String initUpdateForm(@PathVariable("petId") int petId, Model model) {
Pet pet = this.clinicService.findPetById(petId);
@@ -80,7 +80,7 @@ public class PetController {
return "pets/createOrUpdatePetForm";
}
- @RequestMapping(value="/owners/*/pets/{petId}/edit", method = { RequestMethod.PUT, RequestMethod.POST })
+ @RequestMapping(value="/owners/{ownerId}/pets/{petId}/edit", method = { RequestMethod.PUT, RequestMethod.POST })
public String processUpdateForm(@ModelAttribute("pet") Pet pet, BindingResult result, SessionStatus status) {
// we're not using @Valid annotation here because it is easier to define such validation rule in Java
new PetValidator().validate(pet, result);
@@ -90,7 +90,7 @@ public class PetController {
else {
this.clinicService.savePet(pet);
status.setComplete();
- return "redirect:/owners/" + pet.getOwner().getId();
+ return "redirect:/owners/{ownerId}";
}
}
diff --git a/src/main/java/org/springframework/samples/petclinic/web/VisitController.java b/src/main/java/org/springframework/samples/petclinic/web/VisitController.java
index 85a4d5429..1c61dffc1 100644
--- a/src/main/java/org/springframework/samples/petclinic/web/VisitController.java
+++ b/src/main/java/org/springframework/samples/petclinic/web/VisitController.java
@@ -22,7 +22,7 @@ import org.springframework.web.servlet.ModelAndView;
/**
* JavaBean form controller that is used to add a new Visit
to the
* system.
- *
+ *
* @author Juergen Hoeller
* @author Ken Krebs
* @author Arjen Poutsma
@@ -53,7 +53,7 @@ public class VisitController {
return "pets/createOrUpdateVisitForm";
}
- @RequestMapping(value="/owners/*/pets/{petId}/visits/new", method = RequestMethod.POST)
+ @RequestMapping(value="/owners/{ownerId}/pets/{petId}/visits/new", method = RequestMethod.POST)
public String processNewVisitForm(@Valid Visit visit, BindingResult result, SessionStatus status) {
if (result.hasErrors()) {
return "pets/createOrUpdateVisitForm";
@@ -61,10 +61,10 @@ public class VisitController {
else {
this.clinicService.saveVisit(visit);
status.setComplete();
- return "redirect:/owners/" + visit.getPet().getOwner().getId();
+ return "redirect:/owners/{ownerId}";
}
}
-
+
/**
* Custom handler for displaying an list of visits.
*
diff --git a/src/main/webapp/WEB-INF/mvc-core-config.xml b/src/main/webapp/WEB-INF/mvc-core-config.xml
index 6ce11a4a6..2678f7cea 100644
--- a/src/main/webapp/WEB-INF/mvc-core-config.xml
+++ b/src/main/webapp/WEB-INF/mvc-core-config.xml
@@ -17,7 +17,7 @@
-->
-
+
diff --git a/src/main/webapp/WEB-INF/mvc-view-config.xml b/src/main/webapp/WEB-INF/mvc-view-config.xml
index 94ca95fa0..0487164cc 100644
--- a/src/main/webapp/WEB-INF/mvc-view-config.xml
+++ b/src/main/webapp/WEB-INF/mvc-view-config.xml
@@ -19,23 +19,19 @@
- property of the vets view bean, setting it to 'application/vnd.springsource.samples.petclinic+xml'.
-->
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+ xml=application/vnd.springsource.samples.petclinic+xml
+ atom=#{visitList.contentType}
+
+
+
+