org.springframework.samples.petclinic.web
Class EditPetForm

java.lang.Object
  extended by org.springframework.samples.petclinic.web.EditPetForm

@Controller
@RequestMapping(value="/owners/*/pets/{petId}/edit")
@SessionAttributes(value="pet")
public class EditPetForm
extends java.lang.Object

JavaBean Form controller that is used to edit an existing Pet.

Author:
Juergen Hoeller, Ken Krebs, Arjen Poutsma

Constructor Summary
EditPetForm(Clinic clinic)
           
 
Method Summary
 java.lang.String deletePet(int petId)
          Deletes a pet.
 java.util.Collection<PetType> populatePetTypes()
           
 java.lang.String processSubmit(Pet pet, org.springframework.validation.BindingResult result, org.springframework.web.bind.support.SessionStatus status)
          Processes a pet edit form submission.
 void setAllowedFields(org.springframework.web.bind.WebDataBinder dataBinder)
           
 java.lang.String setupForm(int petId, org.springframework.ui.Model model)
          Displays an edit form for the specified owner.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EditPetForm

public EditPetForm(Clinic clinic)
Method Detail

populatePetTypes

@ModelAttribute(value="types")
public java.util.Collection<PetType> populatePetTypes()

setAllowedFields

@InitBinder
public void setAllowedFields(org.springframework.web.bind.WebDataBinder dataBinder)

setupForm

@RequestMapping(method=GET)
public java.lang.String setupForm(@PathVariable(value="petId")
                                                 int petId,
                                                 org.springframework.ui.Model model)
Displays an edit form for the specified owner.

Parameters:
petId - the ID of the pet to edit
model - the input model
Returns:
the edit form view name

processSubmit

@RequestMapping(method={PUT,POST})
public java.lang.String processSubmit(@ModelAttribute(value="pet")
                                                     Pet pet,
                                                     org.springframework.validation.BindingResult result,
                                                     org.springframework.web.bind.support.SessionStatus status)
Processes a pet edit form submission.

Parameters:
pet - the pet
result - the binding results
status - the session status
Returns:
the next view name to display

deletePet

@RequestMapping(method=DELETE)
public java.lang.String deletePet(@PathVariable
                                                 int petId)
Deletes a pet.

Parameters:
petId - the ID of the pet to delete
Returns:
the next view name


Copyright © 2010. All Rights Reserved.