spring-mvc Spring-MVC with annotations @RequestParam


public class EditPetForm {

    public String setupForm(@RequestParam("petId") int petId, ModelMap model) {
        Pet pet = this.clinic.loadPet(petId);
        model.addAttribute("pet", pet);
        return "petForm";

Important to mention, but pretty obvious, is that @RequestParam is intended to work when using HTTP GET method only because only with GET you can send a query string with parameters, and @RequestParam you can bind parameters in the query string to your controller handler parameters.