Skip to content
Snippets Groups Projects
Commit df5c5ca5 authored by Mic's avatar Mic
Browse files

gave more explicit names to JSPs

parent ffa0a6a1
No related branches found
No related tags found
No related merge requests found
Showing
with 23 additions and 23 deletions
...@@ -46,14 +46,14 @@ public class AddOwnerController { ...@@ -46,14 +46,14 @@ public class AddOwnerController {
public String setupForm(Model model) { public String setupForm(Model model) {
Owner owner = new Owner(); Owner owner = new Owner();
model.addAttribute(owner); model.addAttribute(owner);
return "owners/form"; return "owners/createOrUpdateOwnerForm";
} }
@RequestMapping(method = RequestMethod.POST) @RequestMapping(method = RequestMethod.POST)
public String processSubmit(@ModelAttribute Owner owner, BindingResult result, SessionStatus status) { public String processSubmit(@ModelAttribute Owner owner, BindingResult result, SessionStatus status) {
new OwnerValidator().validate(owner, result); new OwnerValidator().validate(owner, result);
if (result.hasErrors()) { if (result.hasErrors()) {
return "owners/form"; return "owners/createOrUpdateOwnerForm";
} }
else { else {
this.clinic.storeOwner(owner); this.clinic.storeOwner(owner);
......
...@@ -58,14 +58,14 @@ public class AddPetController { ...@@ -58,14 +58,14 @@ public class AddPetController {
Pet pet = new Pet(); Pet pet = new Pet();
owner.addPet(pet); owner.addPet(pet);
model.addAttribute("pet", pet); model.addAttribute("pet", pet);
return "pets/form"; return "pets/createOrUpdatePetForm";
} }
@RequestMapping(method = RequestMethod.POST) @RequestMapping(method = RequestMethod.POST)
public String processSubmit(@ModelAttribute("pet") Pet pet, BindingResult result, SessionStatus status) { public String processSubmit(@ModelAttribute("pet") Pet pet, BindingResult result, SessionStatus status) {
new PetValidator().validate(pet, result); new PetValidator().validate(pet, result);
if (result.hasErrors()) { if (result.hasErrors()) {
return "pets/form"; return "pets/createOrUpdatePetForm";
} }
else { else {
this.clinic.storePet(pet); this.clinic.storePet(pet);
......
...@@ -50,14 +50,14 @@ public class AddVisitController { ...@@ -50,14 +50,14 @@ public class AddVisitController {
Visit visit = new Visit(); Visit visit = new Visit();
pet.addVisit(visit); pet.addVisit(visit);
model.addAttribute("visit", visit); model.addAttribute("visit", visit);
return "pets/visitForm"; return "pets/createOrUpdateVisitForm";
} }
@RequestMapping(method = RequestMethod.POST) @RequestMapping(method = RequestMethod.POST)
public String processSubmit(@ModelAttribute("visit") Visit visit, BindingResult result, SessionStatus status) { public String processSubmit(@ModelAttribute("visit") Visit visit, BindingResult result, SessionStatus status) {
new VisitValidator().validate(visit, result); new VisitValidator().validate(visit, result);
if (result.hasErrors()) { if (result.hasErrors()) {
return "pets/visitForm"; return "pets/createOrUpdateVisitForm";
} }
else { else {
this.clinic.storeVisit(visit); this.clinic.storeVisit(visit);
......
...@@ -59,7 +59,7 @@ public class ClinicController { ...@@ -59,7 +59,7 @@ public class ClinicController {
Vets vets = new Vets(); Vets vets = new Vets();
vets.getVetList().addAll(this.clinic.getVets()); vets.getVetList().addAll(this.clinic.getVets());
model.addAttribute("vets", vets); model.addAttribute("vets", vets);
return "vets"; return "vetsList";
} }
/** /**
...@@ -70,7 +70,7 @@ public class ClinicController { ...@@ -70,7 +70,7 @@ public class ClinicController {
*/ */
@RequestMapping("/owners/{ownerId}") @RequestMapping("/owners/{ownerId}")
public ModelAndView showOwner(@PathVariable("ownerId") int ownerId) { public ModelAndView showOwner(@PathVariable("ownerId") int ownerId) {
ModelAndView mav = new ModelAndView("owners/show"); ModelAndView mav = new ModelAndView("owners/ownerDetails");
mav.addObject(this.clinic.findOwner(ownerId)); mav.addObject(this.clinic.findOwner(ownerId));
return mav; return mav;
} }
......
...@@ -46,14 +46,14 @@ public class EditOwnerController { ...@@ -46,14 +46,14 @@ public class EditOwnerController {
public String setupForm(@PathVariable("ownerId") int ownerId, Model model) { public String setupForm(@PathVariable("ownerId") int ownerId, Model model) {
Owner owner = this.clinic.findOwner(ownerId); Owner owner = this.clinic.findOwner(ownerId);
model.addAttribute(owner); model.addAttribute(owner);
return "owners/form"; return "owners/createOrUpdateOwnerForm";
} }
@RequestMapping(method = RequestMethod.PUT) @RequestMapping(method = RequestMethod.PUT)
public String processSubmit(@ModelAttribute Owner owner, BindingResult result, SessionStatus status) { public String processSubmit(@ModelAttribute Owner owner, BindingResult result, SessionStatus status) {
new OwnerValidator().validate(owner, result); new OwnerValidator().validate(owner, result);
if (result.hasErrors()) { if (result.hasErrors()) {
return "owners/form"; return "owners/createOrUpdateOwnerForm";
} }
else { else {
this.clinic.storeOwner(owner); this.clinic.storeOwner(owner);
......
...@@ -54,14 +54,14 @@ public class EditPetController { ...@@ -54,14 +54,14 @@ public class EditPetController {
public String setupForm(@PathVariable("petId") int petId, Model model) { public String setupForm(@PathVariable("petId") int petId, Model model) {
Pet pet = this.clinic.findPet(petId); Pet pet = this.clinic.findPet(petId);
model.addAttribute("pet", pet); model.addAttribute("pet", pet);
return "pets/form"; return "pets/createOrUpdatePetForm";
} }
@RequestMapping(method = { RequestMethod.PUT, RequestMethod.POST }) @RequestMapping(method = { RequestMethod.PUT, RequestMethod.POST })
public String processSubmit(@ModelAttribute("pet") Pet pet, BindingResult result, SessionStatus status) { public String processSubmit(@ModelAttribute("pet") Pet pet, BindingResult result, SessionStatus status) {
new PetValidator().validate(pet, result); new PetValidator().validate(pet, result);
if (result.hasErrors()) { if (result.hasErrors()) {
return "pets/form"; return "pets/createOrUpdatePetForm";
} }
else { else {
this.clinic.storePet(pet); this.clinic.storePet(pet);
......
...@@ -38,10 +38,10 @@ public class FindOwnersController { ...@@ -38,10 +38,10 @@ public class FindOwnersController {
dataBinder.setDisallowedFields("id"); dataBinder.setDisallowedFields("id");
} }
@RequestMapping(value = "/owners/search", method = RequestMethod.GET) @RequestMapping(value = "/owners/find", method = RequestMethod.GET)
public String setupForm(Model model) { public String setupForm(Model model) {
model.addAttribute("owner", new Owner()); model.addAttribute("owner", new Owner());
return "owners/search"; return "owners/findOwners";
} }
@RequestMapping(value = "/owners", method = RequestMethod.GET) @RequestMapping(value = "/owners", method = RequestMethod.GET)
...@@ -57,12 +57,12 @@ public class FindOwnersController { ...@@ -57,12 +57,12 @@ public class FindOwnersController {
if (results.size() < 1) { if (results.size() < 1) {
// no owners found // no owners found
result.rejectValue("lastName", "notFound", "not found"); result.rejectValue("lastName", "notFound", "not found");
return "owners/search"; return "owners/findOwners";
} }
if (results.size() > 1) { if (results.size() > 1) {
// multiple owners found // multiple owners found
model.addAttribute("selections", results); model.addAttribute("selections", results);
return "owners/list"; return "owners/ownersList";
} }
else { else {
// 1 owner found // 1 owner found
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<form:form modelAttribute="visit"> <form:form modelAttribute="visit">
<b>Pet:</b> <b>Pet:</b>
<table width="333"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th>Name</th> <th>Name</th>
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
</tr> </tr>
</table> </table>
<table width="333"> <table class="table">
<tr> <tr>
<th> <th>
Date: Date:
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<h2><fmt:message key="welcome"/></h2> <h2><fmt:message key="welcome"/></h2>
<ul class="unstyled"> <ul class="unstyled">
<li><a href="<spring:url value="/owners/search.html" htmlEscape="true" />">Find owner</a></li> <li><a href="<spring:url value="/owners/find.html" htmlEscape="true" />">Find owner</a></li>
<li><a href="<spring:url value="/vets.html" htmlEscape="true" />">Display all veterinarians</a></li> <li><a href="<spring:url value="/vets.html" htmlEscape="true" />">Display all veterinarians</a></li>
<li><a href="<spring:url value="/resources/html/tutorial.html" htmlEscape="true" />">Tutorial</a></li> <li><a href="<spring:url value="/resources/html/tutorial.html" htmlEscape="true" />">Tutorial</a></li>
</ul> </ul>
......
...@@ -40,8 +40,8 @@ ...@@ -40,8 +40,8 @@
<bean class="org.springframework.web.accept.PathExtensionContentNegotiationStrategy"> <bean class="org.springframework.web.accept.PathExtensionContentNegotiationStrategy">
<constructor-arg> <constructor-arg>
<map> <map>
<entry key="xml" value="#{vets.contentType}"/> <entry key="xml" value="#{vetsList.contentType}"/>
<entry key="atom" value="#{visits.contentType}"/> <entry key="atom" value="#{visitsList.contentType}"/>
</map> </map>
</constructor-arg> </constructor-arg>
</bean> </bean>
...@@ -121,9 +121,9 @@ ...@@ -121,9 +121,9 @@
<!-- - The AtomView rendering a Atom feed of the visits --> <!-- - The AtomView rendering a Atom feed of the visits -->
<bean id="visits" class="org.springframework.samples.petclinic.web.VisitsAtomView"/> <bean id="visitsList" class="org.springframework.samples.petclinic.web.VisitsAtomView"/>
<bean id="vets" class="org.springframework.web.servlet.view.xml.MarshallingView"> <bean id="vetsList" class="org.springframework.web.servlet.view.xml.MarshallingView">
<property name="contentType" value="application/vnd.springsource.samples.petclinic+xml"/> <property name="contentType" value="application/vnd.springsource.samples.petclinic+xml"/>
<property name="marshaller" ref="marshaller"/> <property name="marshaller" ref="marshaller"/>
</bean> </bean>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment