diff --git a/src/main/java/ru/ulstu/conference/controller/ConferenceController.java b/src/main/java/ru/ulstu/conference/controller/ConferenceController.java index 1de420b..006a1de 100644 --- a/src/main/java/ru/ulstu/conference/controller/ConferenceController.java +++ b/src/main/java/ru/ulstu/conference/controller/ConferenceController.java @@ -22,7 +22,6 @@ import static org.springframework.util.StringUtils.isEmpty; import static ru.ulstu.core.controller.Navigation.CONFERENCES_PAGE; import static ru.ulstu.core.controller.Navigation.CONFERENCE_PAGE; import static ru.ulstu.core.controller.Navigation.REDIRECT_TO; -import static ru.ulstu.core.controller.Navigation.hasErrors; @Controller() @@ -56,7 +55,8 @@ public class ConferenceController { if (conferenceDto.getDeadlines().isEmpty()) { errors.rejectValue("deadlines", "errorCode", "Не может быть пустым"); } - hasErrors(errors, CONFERENCE_PAGE); + if (errors.hasErrors()) + return CONFERENCE_PAGE; conferenceService.save(conferenceDto); return String.format(REDIRECT_TO, CONFERENCES_PAGE); @@ -65,7 +65,8 @@ public class ConferenceController { @PostMapping(value = "/conference", params = "addDeadline") public String addDeadline(@Valid ConferenceDto conferenceDto, Errors errors) { filterEmptyDeadlines(conferenceDto); - hasErrors(errors, CONFERENCE_PAGE); + if (errors.hasErrors()) + return CONFERENCE_PAGE; conferenceDto.getDeadlines().add(new Deadline()); return CONFERENCE_PAGE; } diff --git a/src/main/resources/templates/conferences/conference.html b/src/main/resources/templates/conferences/conference.html index 3917128..cbc0019 100644 --- a/src/main/resources/templates/conferences/conference.html +++ b/src/main/resources/templates/conferences/conference.html @@ -30,6 +30,9 @@ +

Incorrect title

+

@@ -61,11 +64,12 @@ $('#deadlines${rowStat.index}\\.date').val(''); $('#addDeadline').click();|"/>
-

Incorrect title

+

+