From c5d0bd083faa1b8b6d1aca77d5d038e489593bcb Mon Sep 17 00:00:00 2001 From: Zakharov_Rostislav Date: Wed, 5 Jun 2024 21:32:19 +0400 Subject: [PATCH] mvc fix controllers --- SpringApp/library/index.html | 61 ------------------- .../controllers/authors/AuthorController.java | 4 +- .../controllers/books/BookController.java | 4 +- .../controllers/types/TypeController.java | 5 +- .../controllers/users/UserController.java | 4 +- 5 files changed, 8 insertions(+), 70 deletions(-) delete mode 100644 SpringApp/library/index.html diff --git a/SpringApp/library/index.html b/SpringApp/library/index.html deleted file mode 100644 index 55419a6..0000000 --- a/SpringApp/library/index.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - Document - - -

Push the button

- -
- -
- -
- -
- - - - \ No newline at end of file diff --git a/SpringApp/library/src/main/java/com/ip/library/controllers/authors/AuthorController.java b/SpringApp/library/src/main/java/com/ip/library/controllers/authors/AuthorController.java index 05b1905..a04f16f 100644 --- a/SpringApp/library/src/main/java/com/ip/library/controllers/authors/AuthorController.java +++ b/SpringApp/library/src/main/java/com/ip/library/controllers/authors/AuthorController.java @@ -1,6 +1,7 @@ package com.ip.library.controllers.authors; import org.modelmapper.ModelMapper; +import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; @@ -8,14 +9,13 @@ import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; import com.ip.library.core.configuration.Constants; import jakarta.validation.Valid; -@RestController +@Controller @RequestMapping(AuthorController.URL) public class AuthorController { public static final String URL = Constants.API_URL + "/author"; diff --git a/SpringApp/library/src/main/java/com/ip/library/controllers/books/BookController.java b/SpringApp/library/src/main/java/com/ip/library/controllers/books/BookController.java index 8048ef3..934e428 100644 --- a/SpringApp/library/src/main/java/com/ip/library/controllers/books/BookController.java +++ b/SpringApp/library/src/main/java/com/ip/library/controllers/books/BookController.java @@ -3,6 +3,7 @@ package com.ip.library.controllers.books; import java.util.Map; import org.modelmapper.ModelMapper; +import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; @@ -11,7 +12,6 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.ip.library.controllers.types.TypeService; @@ -20,7 +20,7 @@ import com.ip.library.core.configuration.Constants; import jakarta.validation.Valid; -@RestController +@Controller @RequestMapping(BookController.URL) public class BookController { public static final String URL = Constants.API_URL + "/book"; diff --git a/SpringApp/library/src/main/java/com/ip/library/controllers/types/TypeController.java b/SpringApp/library/src/main/java/com/ip/library/controllers/types/TypeController.java index fa3e1ff..363a21e 100644 --- a/SpringApp/library/src/main/java/com/ip/library/controllers/types/TypeController.java +++ b/SpringApp/library/src/main/java/com/ip/library/controllers/types/TypeController.java @@ -1,6 +1,7 @@ package com.ip.library.controllers.types; import org.modelmapper.ModelMapper; +import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; @@ -8,13 +9,11 @@ import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - import com.ip.library.core.configuration.Constants; import jakarta.validation.Valid; -@RestController +@Controller @RequestMapping(TypeController.URL) public class TypeController { public static final String URL = Constants.API_URL + "/type"; diff --git a/SpringApp/library/src/main/java/com/ip/library/controllers/users/UserController.java b/SpringApp/library/src/main/java/com/ip/library/controllers/users/UserController.java index 751b1a4..6a31b0b 100644 --- a/SpringApp/library/src/main/java/com/ip/library/controllers/users/UserController.java +++ b/SpringApp/library/src/main/java/com/ip/library/controllers/users/UserController.java @@ -3,6 +3,7 @@ package com.ip.library.controllers.users; import java.util.Map; import org.modelmapper.ModelMapper; +import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; @@ -11,7 +12,6 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.ip.library.core.api.PageAttributesMapper; @@ -19,7 +19,7 @@ import com.ip.library.core.configuration.Constants; import jakarta.validation.Valid; -@RestController +@Controller @RequestMapping(UserController.URL) public class UserController { public static final String URL = Constants.API_URL + "/user";