From 05296bb26e98c1b4c07f90040aaa8ff0dbc5d72b Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Mon, 17 Dec 2018 17:28:52 +0400 Subject: [PATCH] fix route --- src/main/java/ru/ulstu/paper/controller/PaperController.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/ru/ulstu/paper/controller/PaperController.java b/src/main/java/ru/ulstu/paper/controller/PaperController.java index f6438ab..36d72fe 100644 --- a/src/main/java/ru/ulstu/paper/controller/PaperController.java +++ b/src/main/java/ru/ulstu/paper/controller/PaperController.java @@ -56,8 +56,11 @@ public class PaperController { } @PostMapping(value = "/paper", params = "addDeadline") - public String addDeadline(@Valid PaperDto paperDto) { + public String addDeadline(@Valid PaperDto paperDto, Errors errors) { filterEmptyDeadlines(paperDto); + if (errors.hasErrors()) { + return "/papers/paper"; + } paperDto.getDeadlines().add(new DeadlineDto()); return "/papers/paper"; }