From 1929f67f02b2c736ed4c6e46f93ba495cd6ca18a Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Thu, 20 Nov 2008 23:42:20 +0000 Subject: [PATCH] Petclinic is RESTful. --- .../db/hsqldb/petclinic.script | 2 +- org.springframework.samples.petclinic/ivy.xml | 1 + .../petclinic.iml | 15 +++++++++++ .../samples/petclinic/Clinic.java | 5 ++++ .../petclinic/hibernate/HibernateClinic.java | 6 +++++ .../petclinic/jdbc/SimpleJdbcClinic.java | 4 +++ .../petclinic/jpa/EntityManagerClinic.java | 6 +++++ .../samples/petclinic/web/AddOwnerForm.java | 5 ++-- .../samples/petclinic/web/AddPetForm.java | 8 +++--- .../samples/petclinic/web/AddVisitForm.java | 8 +++--- .../petclinic/web/ClinicController.java | 20 +++++++------- .../samples/petclinic/web/EditOwnerForm.java | 8 +++--- .../samples/petclinic/web/EditPetForm.java | 15 ++++++++--- .../samples/petclinic/web/FindOwnersForm.java | 8 +++--- .../src/main/resources/messages.properties | 8 ++++++ .../src/main/resources/messages_de.properties | 8 ++++++ .../src/main/resources/messages_en.properties | 1 + .../webapp/WEB-INF/jsp/dataAccessFailure.jsp | 2 +- .../main/webapp/WEB-INF/jsp/findOwners.jsp | 7 ++--- .../src/main/webapp/WEB-INF/jsp/footer.jsp | 4 +-- .../src/main/webapp/WEB-INF/jsp/header.jsp | 2 +- .../src/main/webapp/WEB-INF/jsp/owner.jsp | 27 ++++++++----------- .../src/main/webapp/WEB-INF/jsp/owners.jsp | 5 +++- .../src/main/webapp/WEB-INF/jsp/petForm.jsp | 6 +++++ .../src/main/webapp/WEB-INF/jsp/welcome.jsp | 9 +++---- .../src/main/webapp/WEB-INF/web.xml | 12 ++++++++- .../src/main/webapp/index.jsp | 2 +- 27 files changed, 144 insertions(+), 60 deletions(-) create mode 100644 org.springframework.samples.petclinic/src/main/resources/messages.properties create mode 100644 org.springframework.samples.petclinic/src/main/resources/messages_de.properties create mode 100644 org.springframework.samples.petclinic/src/main/resources/messages_en.properties diff --git a/org.springframework.samples.petclinic/db/hsqldb/petclinic.script b/org.springframework.samples.petclinic/db/hsqldb/petclinic.script index 4a712247d4..8ce9564131 100644 --- a/org.springframework.samples.petclinic/db/hsqldb/petclinic.script +++ b/org.springframework.samples.petclinic/db/hsqldb/petclinic.script @@ -10,7 +10,7 @@ CREATE MEMORY TABLE OWNERS(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WIT CREATE INDEX OWNERS_LAST_NAME ON OWNERS(LAST_NAME) CREATE MEMORY TABLE PETS(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,NAME VARCHAR(30),BIRTH_DATE DATE,TYPE_ID INTEGER NOT NULL,OWNER_ID INTEGER NOT NULL,CONSTRAINT FK_PETS_OWNERS FOREIGN KEY(OWNER_ID) REFERENCES OWNERS(ID),CONSTRAINT FK_PETS_TYPES FOREIGN KEY(TYPE_ID) REFERENCES TYPES(ID)) CREATE INDEX PETS_NAME ON PETS(NAME) -CREATE MEMORY TABLE VISITS(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,PET_ID INTEGER NOT NULL,VISIT_DATE DATE,DESCRIPTION VARCHAR(255),CONSTRAINT FK_VISITS_PETS FOREIGN KEY(PET_ID) REFERENCES PETS(ID)) +CREATE MEMORY TABLE VISITS(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,PET_ID INTEGER NOT NULL,VISIT_DATE DATE,DESCRIPTION VARCHAR(255),CONSTRAINT FK_VISITS_PETS FOREIGN KEY(PET_ID) REFERENCES PETS(ID) ON DELETE CASCADE) CREATE INDEX VISITS_PET_ID ON VISITS(PET_ID) ALTER TABLE VETS ALTER COLUMN ID RESTART WITH 7 ALTER TABLE SPECIALTIES ALTER COLUMN ID RESTART WITH 4 diff --git a/org.springframework.samples.petclinic/ivy.xml b/org.springframework.samples.petclinic/ivy.xml index f4084a43e9..d713021544 100644 --- a/org.springframework.samples.petclinic/ivy.xml +++ b/org.springframework.samples.petclinic/ivy.xml @@ -25,6 +25,7 @@ + diff --git a/org.springframework.samples.petclinic/petclinic.iml b/org.springframework.samples.petclinic/petclinic.iml index b9f523aa0a..6d29da7ba4 100644 --- a/org.springframework.samples.petclinic/petclinic.iml +++ b/org.springframework.samples.petclinic/petclinic.iml @@ -36,6 +36,11 @@ + + + + jar://$IVY_CACHE$/org.apache.taglibs/com.springsource.org.apache.taglibs.standard/1.1.2/com.springsource.org.apache.taglibs.standard-1.1.2.jar!/ + @@ -47,6 +52,7 @@ + @@ -130,6 +136,15 @@ + + + + + + + + + diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Clinic.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Clinic.java index 872bd457c2..e48e8507b3 100644 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Clinic.java +++ b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/Clinic.java @@ -74,4 +74,9 @@ public interface Clinic { */ void storeVisit(Visit visit) throws DataAccessException; + /** + * Deletes a Pet from the data store. + */ + void deletePet(int id) throws DataAccessException; + } diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/hibernate/HibernateClinic.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/hibernate/HibernateClinic.java index 89eda8522c..4d199f05cf 100644 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/hibernate/HibernateClinic.java +++ b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/hibernate/HibernateClinic.java @@ -13,6 +13,7 @@ import org.springframework.samples.petclinic.Vet; import org.springframework.samples.petclinic.Visit; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; +import org.springframework.dao.DataAccessException; /** * Hibernate implementation of the Clinic interface. @@ -86,4 +87,9 @@ public class HibernateClinic implements Clinic { sessionFactory.getCurrentSession().merge(visit); } + public void deletePet(int id) throws DataAccessException { + Pet pet = loadPet(id); + sessionFactory.getCurrentSession().delete(pet); + } + } diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jdbc/SimpleJdbcClinic.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jdbc/SimpleJdbcClinic.java index 6794c80ab5..587acecb95 100644 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jdbc/SimpleJdbcClinic.java +++ b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jdbc/SimpleJdbcClinic.java @@ -240,6 +240,10 @@ public class SimpleJdbcClinic implements Clinic, SimpleJdbcClinicMBean { } } + public void deletePet(int id) throws DataAccessException { + this.simpleJdbcTemplate.update("DELETE FROM pets WHERE id=?", id); + } + // END of Clinic implementation section ************************************ diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jpa/EntityManagerClinic.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jpa/EntityManagerClinic.java index ff6907094d..92fe1e2477 100644 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jpa/EntityManagerClinic.java +++ b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/jpa/EntityManagerClinic.java @@ -14,6 +14,7 @@ import org.springframework.samples.petclinic.Vet; import org.springframework.samples.petclinic.Visit; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; +import org.springframework.dao.DataAccessException; /** * JPA implementation of the Clinic interface using EntityManager. @@ -87,4 +88,9 @@ public class EntityManagerClinic implements Clinic { visit.setId(merged.getId()); } + public void deletePet(int id) throws DataAccessException { + Pet pet = loadPet(id); + this.em.remove(pet); + } + } diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/AddOwnerForm.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/AddOwnerForm.java index 4f05867d32..3fd60b3af4 100644 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/AddOwnerForm.java +++ b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/AddOwnerForm.java @@ -21,9 +21,10 @@ import org.springframework.web.bind.WebDataBinder; * * @author Juergen Hoeller * @author Ken Krebs + * @author Arjen Poutsma */ @Controller -@RequestMapping("/addOwner.do") +@RequestMapping("/owners/new") @SessionAttributes(types = Owner.class) public class AddOwnerForm { @@ -55,7 +56,7 @@ public class AddOwnerForm { else { this.clinic.storeOwner(owner); status.setComplete(); - return "redirect:owner.do?ownerId=" + owner.getId(); + return "redirect:/clinic/owners/" + owner.getId(); } } diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/AddPetForm.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/AddPetForm.java index 62d7234979..4c036f33b5 100644 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/AddPetForm.java +++ b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/AddPetForm.java @@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.SessionAttributes; import org.springframework.web.bind.annotation.InitBinder; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.support.SessionStatus; import org.springframework.web.bind.WebDataBinder; @@ -26,9 +27,10 @@ import org.springframework.web.bind.WebDataBinder; * * @author Juergen Hoeller * @author Ken Krebs + * @author Arjen Poutsma */ @Controller -@RequestMapping("/addPet.do") +@RequestMapping("/owners/{ownerId}/pets/new") @SessionAttributes("pet") public class AddPetForm { @@ -50,7 +52,7 @@ public class AddPetForm { } @RequestMapping(method = RequestMethod.GET) - public String setupForm(@RequestParam("ownerId") int ownerId, Model model) { + public String setupForm(@PathVariable("ownerId") int ownerId, Model model) { Owner owner = this.clinic.loadOwner(ownerId); Pet pet = new Pet(); owner.addPet(pet); @@ -67,7 +69,7 @@ public class AddPetForm { else { this.clinic.storePet(pet); status.setComplete(); - return "redirect:owner.do?ownerId=" + pet.getOwner().getId(); + return "redirect:/clinic/owners/" + pet.getOwner().getId(); } } diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/AddVisitForm.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/AddVisitForm.java index 10015e18bc..ea7c5554ca 100644 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/AddVisitForm.java +++ b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/AddVisitForm.java @@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.SessionAttributes; import org.springframework.web.bind.annotation.InitBinder; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.support.SessionStatus; import org.springframework.web.bind.WebDataBinder; @@ -23,9 +24,10 @@ import org.springframework.web.bind.WebDataBinder; * * @author Juergen Hoeller * @author Ken Krebs + * @author Arjen Poutsma */ @Controller -@RequestMapping("/addVisit.do") +@RequestMapping("/owners/*/pets/{petId}/visits/new") @SessionAttributes("visit") public class AddVisitForm { @@ -42,7 +44,7 @@ public class AddVisitForm { } @RequestMapping(method = RequestMethod.GET) - public String setupForm(@RequestParam("petId") int petId, Model model) { + public String setupForm(@PathVariable("petId") int petId, Model model) { Pet pet = this.clinic.loadPet(petId); Visit visit = new Visit(); pet.addVisit(visit); @@ -59,7 +61,7 @@ public class AddVisitForm { else { this.clinic.storeVisit(visit); status.setComplete(); - return "redirect:owner.do?ownerId=" + visit.getPet().getOwner().getId(); + return "redirect:/clinic/owners/" + visit.getPet().getOwner().getId(); } } diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/ClinicController.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/ClinicController.java index 5ac90f581e..aaa7591c1c 100644 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/ClinicController.java +++ b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/ClinicController.java @@ -7,6 +7,8 @@ import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.servlet.ModelAndView; /** * Annotation-driven MultiActionController that handles all non-form @@ -15,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestParam; * @author Juergen Hoeller * @author Mark Fisher * @author Ken Krebs + * @author Arjen Poutsma */ @Controller public class ClinicController { @@ -34,7 +37,7 @@ public class ClinicController { * determine the logical view name based on the request URL: "/welcome.do" * -> "welcome". */ - @RequestMapping("/welcome.do") + @RequestMapping("/welcome") public void welcomeHandler() { } @@ -48,25 +51,22 @@ public class ClinicController { * * @return a ModelMap with the model attributes for the view */ - @RequestMapping("/vets.do") + @RequestMapping("/vets") public ModelMap vetsHandler() { return new ModelMap(this.clinic.getVets()); } /** * Custom handler for displaying an owner. - *

- * Note that this handler returns a plain {@link ModelMap} object instead of - * a ModelAndView, thus leveraging convention-based model attribute names. - * It relies on the RequestToViewNameTranslator to determine the logical - * view name based on the request URL: "/owner.do" -> "owner". * * @param ownerId the ID of the owner to display * @return a ModelMap with the model attributes for the view */ - @RequestMapping("/owner.do") - public ModelMap ownerHandler(@RequestParam("ownerId") int ownerId) { - return new ModelMap(this.clinic.loadOwner(ownerId)); + @RequestMapping("/owners/{ownerId}") + public ModelAndView ownerHandler(@PathVariable("ownerId") int ownerId) { + ModelAndView mav = new ModelAndView("owner"); + mav.addObject(this.clinic.loadOwner(ownerId)); + return mav; } } diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/EditOwnerForm.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/EditOwnerForm.java index 424c184c54..35f4fb72ae 100644 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/EditOwnerForm.java +++ b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/EditOwnerForm.java @@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.SessionAttributes; import org.springframework.web.bind.annotation.InitBinder; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.support.SessionStatus; import org.springframework.web.bind.WebDataBinder; @@ -21,9 +22,10 @@ import org.springframework.web.bind.WebDataBinder; * * @author Juergen Hoeller * @author Ken Krebs + * @author Arjen Poutsma */ @Controller -@RequestMapping("/editOwner.do") +@RequestMapping("/owners/{ownerId}/edit") @SessionAttributes(types = Owner.class) public class EditOwnerForm { @@ -40,7 +42,7 @@ public class EditOwnerForm { } @RequestMapping(method = RequestMethod.GET) - public String setupForm(@RequestParam("ownerId") int ownerId, Model model) { + public String setupForm(@PathVariable("ownerId") int ownerId, Model model) { Owner owner = this.clinic.loadOwner(ownerId); model.addAttribute(owner); return "ownerForm"; @@ -55,7 +57,7 @@ public class EditOwnerForm { else { this.clinic.storeOwner(owner); status.setComplete(); - return "redirect:owner.do?ownerId=" + owner.getId(); + return "redirect:/clinic/owners/" + owner.getId(); } } diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/EditPetForm.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/EditPetForm.java index 0a1033e669..504c2ac183 100644 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/EditPetForm.java +++ b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/EditPetForm.java @@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.SessionAttributes; import org.springframework.web.bind.annotation.InitBinder; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.support.SessionStatus; import org.springframework.web.bind.WebDataBinder; @@ -24,9 +25,10 @@ import org.springframework.web.bind.WebDataBinder; * * @author Juergen Hoeller * @author Ken Krebs + * @author Arjen Poutsma */ @Controller -@RequestMapping("/editPet.do") +@RequestMapping("/owners/*/pets/{petId}") @SessionAttributes("pet") public class EditPetForm { @@ -48,7 +50,7 @@ public class EditPetForm { } @RequestMapping(method = RequestMethod.GET) - public String setupForm(@RequestParam("petId") int petId, Model model) { + public String setupForm(@PathVariable("petId") int petId, Model model) { Pet pet = this.clinic.loadPet(petId); model.addAttribute("pet", pet); return "petForm"; @@ -63,8 +65,15 @@ public class EditPetForm { else { this.clinic.storePet(pet); status.setComplete(); - return "redirect:owner.do?ownerId=" + pet.getOwner().getId(); + return "redirect:/clinic/owners/" + pet.getOwner().getId(); } } + @RequestMapping(method = RequestMethod.DELETE) + public String deletePet(@PathVariable int petId) { + Pet pet = this.clinic.loadPet(petId); + this.clinic.deletePet(petId); + return "redirect:/clinic/owners/" + pet.getOwner().getId(); + } + } diff --git a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/FindOwnersForm.java b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/FindOwnersForm.java index e0ea8efdf2..bd1ff4ffc6 100644 --- a/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/FindOwnersForm.java +++ b/org.springframework.samples.petclinic/src/main/java/org/springframework/samples/petclinic/web/FindOwnersForm.java @@ -19,9 +19,9 @@ import org.springframework.web.bind.WebDataBinder; * * @author Juergen Hoeller * @author Ken Krebs + * @author Arjen Poutsma */ @Controller -@RequestMapping("/findOwners.do") public class FindOwnersForm { private final Clinic clinic; @@ -36,13 +36,13 @@ public class FindOwnersForm { dataBinder.setDisallowedFields(new String[] {"id"}); } - @RequestMapping(method = RequestMethod.GET) + @RequestMapping(value = "/owners/form", method = RequestMethod.GET) public String setupForm(Model model) { model.addAttribute("owner", new Owner()); return "findOwners"; } - @RequestMapping(method = RequestMethod.POST) + @RequestMapping(value = "/owners", method = RequestMethod.GET) public String processSubmit(Owner owner, BindingResult result, Model model) { // find owners by last name Collection results = this.clinic.findOwners(owner.getLastName()); @@ -59,7 +59,7 @@ public class FindOwnersForm { else { // 1 owner found owner = results.iterator().next(); - return "redirect:owner.do?ownerId=" + owner.getId(); + return "redirect:/clinic/owners/" + owner.getId(); } } diff --git a/org.springframework.samples.petclinic/src/main/resources/messages.properties b/org.springframework.samples.petclinic/src/main/resources/messages.properties new file mode 100644 index 0000000000..173417a101 --- /dev/null +++ b/org.springframework.samples.petclinic/src/main/resources/messages.properties @@ -0,0 +1,8 @@ +welcome=Welcome +required=is required +notFound=has not been found +duplicate=is already in use +nonNumeric=must be all numeric +duplicateFormSubmission=Duplicate form submission is not allowed +typeMismatch.date=invalid date +typeMismatch.birthDate=invalid date diff --git a/org.springframework.samples.petclinic/src/main/resources/messages_de.properties b/org.springframework.samples.petclinic/src/main/resources/messages_de.properties new file mode 100644 index 0000000000..124bee48b2 --- /dev/null +++ b/org.springframework.samples.petclinic/src/main/resources/messages_de.properties @@ -0,0 +1,8 @@ +welcome=Willkommen +required=muss angegeben werden +notFound=wurde nicht gefunden +duplicate=ist bereits vergeben +nonNumeric=darf nur numerisch sein +duplicateFormSubmission=Wiederholtes Absenden des Formulars ist nicht erlaubt +typeMismatch.date=ungültiges Datum +typeMismatch.birthDate=ungültiges Datum diff --git a/org.springframework.samples.petclinic/src/main/resources/messages_en.properties b/org.springframework.samples.petclinic/src/main/resources/messages_en.properties new file mode 100644 index 0000000000..05d519bb86 --- /dev/null +++ b/org.springframework.samples.petclinic/src/main/resources/messages_en.properties @@ -0,0 +1 @@ +# This file is intentionally empty. Message look-ups will fall back to the default "messages.properties" file. \ No newline at end of file diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/dataAccessFailure.jsp b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/dataAccessFailure.jsp index 1a2c758e89..72ee76462d 100644 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/dataAccessFailure.jsp +++ b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/dataAccessFailure.jsp @@ -14,6 +14,6 @@ ex.printStackTrace(new java.io.PrintWriter(out));


-">Home +">Home <%@ include file="/WEB-INF/jsp/footer.jsp" %> diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/findOwners.jsp b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/findOwners.jsp index c2c15e080e..24b2858be8 100644 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/findOwners.jsp +++ b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/findOwners.jsp @@ -3,13 +3,14 @@

Find Owners:

- + + @@ -19,6 +20,6 @@
-">Add Owner +Add Owner <%@ include file="/WEB-INF/jsp/footer.jsp" %> diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/footer.jsp b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/footer.jsp index c9b0ac1b37..6fe33c1ea4 100644 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/footer.jsp +++ b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/footer.jsp @@ -1,8 +1,8 @@
Last Name:
- +
- - + + diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/header.jsp b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/header.jsp index c8c08c25d0..b948caccb0 100644 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/header.jsp +++ b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/header.jsp @@ -5,7 +5,7 @@ - " type="text/css"/> + " type="text/css"/> PetClinic :: a Spring Framework demonstration diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/owner.jsp b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/owner.jsp index dc4724c6b4..1d1c1ae7d6 100644 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/owner.jsp +++ b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/owner.jsp @@ -24,16 +24,10 @@
-
"> - -

-
+ ">Edit Owner
-
" name="formAddPet"> - -

-
+ ">Add New Pet
@@ -80,16 +74,17 @@ +
-
" name="formEditPet${pet.id}"> - -

-
+ + + + Edit Pet
-
" name="formVisitPet${pet.id}"> - -

-
+ + + + Add Visit
diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/owners.jsp b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/owners.jsp index b9b5688a05..c7e5465a3b 100644 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/owners.jsp +++ b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/owners.jsp @@ -16,7 +16,10 @@ - ${owner.firstName} ${owner.lastName} + + + + ${owner.firstName} ${owner.lastName} ${owner.address} ${owner.city} diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/petForm.jsp b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/petForm.jsp index 49ba1de860..0bbd16b5ba 100644 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/petForm.jsp +++ b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/petForm.jsp @@ -44,4 +44,10 @@
+ + +

+
+
+ <%@ include file="/WEB-INF/jsp/footer.jsp" %> diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/welcome.jsp b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/welcome.jsp index d5072b70ba..cdd69ec2a8 100644 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/welcome.jsp +++ b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/jsp/welcome.jsp @@ -1,14 +1,13 @@ <%@ include file="/WEB-INF/jsp/includes.jsp" %> <%@ include file="/WEB-INF/jsp/header.jsp" %> - +" align="right" style="position:relative;right:30px;">

 

diff --git a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/web.xml b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/web.xml index da45f51f56..11daf0024b 100644 --- a/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/web.xml +++ b/org.springframework.samples.petclinic/src/main/webapp/WEB-INF/web.xml @@ -110,9 +110,19 @@ --> petclinic - *.do + /clinic/* + + httpMethodFilter + org.springframework.web.filter.HiddenHttpMethodFilter + + + + httpMethodFilter + petclinic + + 10 diff --git a/org.springframework.samples.petclinic/src/main/webapp/index.jsp b/org.springframework.samples.petclinic/src/main/webapp/index.jsp index b1bf425fc0..d8a29c3100 100644 --- a/org.springframework.samples.petclinic/src/main/webapp/index.jsp +++ b/org.springframework.samples.petclinic/src/main/webapp/index.jsp @@ -1,5 +1,5 @@ <%@ include file="/WEB-INF/jsp/includes.jsp" %> <%-- Redirected because we can't set the welcome page to a virtual URL. --%> - +