if (request.getParameter("_cancel") != null) {
response.setRenderParameter("action", "list");
}
else if (request.getParameter("_finish") != null) {
new PetValidator().validate(pet, result);
if (!result.hasErrors()) {
this.petService.addPet(pet);
response.setRenderParameter("action", "list");
}
else {
model.addAttribute("page", currentPage);
}
}
else {
switch (currentPage) {
case 0: new PetValidator().validateSpecies(pet, result); break;
case 1: new PetValidator().validateBreed(pet, result); break;
case 2: new PetValidator().validateName(pet, result); break;
case 3: new PetValidator().validateBirthdate(pet, result); break;
}
int targetPage = currentPage;
if (!result.hasErrors()) {
targetPage = PortletUtils.getTargetPage(request, "_target", currentPage);
}