gave more explicit names to JSPs

This commit is contained in:
Mic 2013-01-15 10:57:36 +08:00
parent ffa0a6a1cf
commit df5c5ca59d
16 changed files with 23 additions and 23 deletions

View file

@ -46,14 +46,14 @@ public class AddOwnerController {
public String setupForm(Model model) {
Owner owner = new Owner();
model.addAttribute(owner);
return "owners/form";
return "owners/createOrUpdateOwnerForm";
}
@RequestMapping(method = RequestMethod.POST)
public String processSubmit(@ModelAttribute Owner owner, BindingResult result, SessionStatus status) {
new OwnerValidator().validate(owner, result);
if (result.hasErrors()) {
return "owners/form";
return "owners/createOrUpdateOwnerForm";
}
else {
this.clinic.storeOwner(owner);

View file

@ -58,14 +58,14 @@ public class AddPetController {
Pet pet = new Pet();
owner.addPet(pet);
model.addAttribute("pet", pet);
return "pets/form";
return "pets/createOrUpdatePetForm";
}
@RequestMapping(method = RequestMethod.POST)
public String processSubmit(@ModelAttribute("pet") Pet pet, BindingResult result, SessionStatus status) {
new PetValidator().validate(pet, result);
if (result.hasErrors()) {
return "pets/form";
return "pets/createOrUpdatePetForm";
}
else {
this.clinic.storePet(pet);

View file

@ -50,14 +50,14 @@ public class AddVisitController {
Visit visit = new Visit();
pet.addVisit(visit);
model.addAttribute("visit", visit);
return "pets/visitForm";
return "pets/createOrUpdateVisitForm";
}
@RequestMapping(method = RequestMethod.POST)
public String processSubmit(@ModelAttribute("visit") Visit visit, BindingResult result, SessionStatus status) {
new VisitValidator().validate(visit, result);
if (result.hasErrors()) {
return "pets/visitForm";
return "pets/createOrUpdateVisitForm";
}
else {
this.clinic.storeVisit(visit);

View file

@ -59,7 +59,7 @@ public class ClinicController {
Vets vets = new Vets();
vets.getVetList().addAll(this.clinic.getVets());
model.addAttribute("vets", vets);
return "vets";
return "vetsList";
}
/**
@ -70,7 +70,7 @@ public class ClinicController {
*/
@RequestMapping("/owners/{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));
return mav;
}

View file

@ -46,14 +46,14 @@ public class EditOwnerController {
public String setupForm(@PathVariable("ownerId") int ownerId, Model model) {
Owner owner = this.clinic.findOwner(ownerId);
model.addAttribute(owner);
return "owners/form";
return "owners/createOrUpdateOwnerForm";
}
@RequestMapping(method = RequestMethod.PUT)
public String processSubmit(@ModelAttribute Owner owner, BindingResult result, SessionStatus status) {
new OwnerValidator().validate(owner, result);
if (result.hasErrors()) {
return "owners/form";
return "owners/createOrUpdateOwnerForm";
}
else {
this.clinic.storeOwner(owner);

View file

@ -54,14 +54,14 @@ public class EditPetController {
public String setupForm(@PathVariable("petId") int petId, Model model) {
Pet pet = this.clinic.findPet(petId);
model.addAttribute("pet", pet);
return "pets/form";
return "pets/createOrUpdatePetForm";
}
@RequestMapping(method = { RequestMethod.PUT, RequestMethod.POST })
public String processSubmit(@ModelAttribute("pet") Pet pet, BindingResult result, SessionStatus status) {
new PetValidator().validate(pet, result);
if (result.hasErrors()) {
return "pets/form";
return "pets/createOrUpdatePetForm";
}
else {
this.clinic.storePet(pet);

View file

@ -38,10 +38,10 @@ public class FindOwnersController {
dataBinder.setDisallowedFields("id");
}
@RequestMapping(value = "/owners/search", method = RequestMethod.GET)
@RequestMapping(value = "/owners/find", method = RequestMethod.GET)
public String setupForm(Model model) {
model.addAttribute("owner", new Owner());
return "owners/search";
return "owners/findOwners";
}
@RequestMapping(value = "/owners", method = RequestMethod.GET)
@ -57,12 +57,12 @@ public class FindOwnersController {
if (results.size() < 1) {
// no owners found
result.rejectValue("lastName", "notFound", "not found");
return "owners/search";
return "owners/findOwners";
}
if (results.size() > 1) {
// multiple owners found
model.addAttribute("selections", results);
return "owners/list";
return "owners/ownersList";
}
else {
// 1 owner found

View file

@ -18,7 +18,7 @@
<form:form modelAttribute="visit">
<b>Pet:</b>
<table width="333">
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
@ -35,7 +35,7 @@
</tr>
</table>
<table width="333">
<table class="table">
<tr>
<th>
Date:

View file

@ -14,7 +14,7 @@
<h2><fmt:message key="welcome"/></h2>
<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="/resources/html/tutorial.html" htmlEscape="true" />">Tutorial</a></li>
</ul>

View file

@ -40,8 +40,8 @@
<bean class="org.springframework.web.accept.PathExtensionContentNegotiationStrategy">
<constructor-arg>
<map>
<entry key="xml" value="#{vets.contentType}"/>
<entry key="atom" value="#{visits.contentType}"/>
<entry key="xml" value="#{vetsList.contentType}"/>
<entry key="atom" value="#{visitsList.contentType}"/>
</map>
</constructor-arg>
</bean>
@ -121,9 +121,9 @@
<!-- - 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="marshaller" ref="marshaller"/>
</bean>