spring-mvc

Errors in pom.xml with dependencies (Missing artifact…)

假如想象 提交于 2020-05-25 03:31:07
问题 A friend has passed me a Maven project that I'm trying to run locally in my computer. All that I have done in Eclipse, I selected: File -> Import -> Existing Maven Projects After that, the project showed me 4 errors in my pom.xml (Missing artifact..): I tried removing the content of .m2 folder and then in Eclipse I clicked on my project and chose "Run as" -> "Maven clean" and then "Run as" -> "Maven install". But I still have the same errors. I'm new with Spring so I dont know what else to do

Thymeleaf: how to include page specific javascript using layouts?

老子叫甜甜 提交于 2020-05-24 18:16:12
问题 Using thymeleaf is there a way to decorate my layout w/ my page specific javascript and javascript includes? <!--My Layout --> <!DOCTYPE html> <html> <head> </head> <body> <div th:replace="fragments/header :: header"> </div> <div class="container"> <div layout:fragment="content"> </div> </div> </body> </html> <!--My Page --> <!DOCTYPE html> <html layout:decorator="layout"> <head> </head> <body> <div layout:fragment="content"> hello world </div> <script src="pageSpecific1.js"></script> <script

Circular view path [login]: would dispatch back to the current handler URL [/login] again

我是研究僧i 提交于 2020-05-17 08:13:51
问题 Circular view path [login]: would dispatch back to the current handler URL [/login] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.) 回答1: Add this dependency <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> 来源: https://stackoverflow.com/questions/57801941/circular-view-path-login-would-dispatch-back-to-the-current-handler-url-log

Circular view path [login]: would dispatch back to the current handler URL [/login] again

早过忘川 提交于 2020-05-17 08:12:10
问题 Circular view path [login]: would dispatch back to the current handler URL [/login] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.) 回答1: Add this dependency <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> 来源: https://stackoverflow.com/questions/57801941/circular-view-path-login-would-dispatch-back-to-the-current-handler-url-log

Binding a list of form backing beans to a list of form

Deadly 提交于 2020-05-17 07:06:42
问题 I have a list of time entry for which i want to create a modal for in my page. Each time entry will have it's own modal. Inside of these modal, i want to put a form. Each form must point to one of the time entry backing bean. Here is the relevant part of the endpoint attach to this page @GetMapping("/time/{year}/{month}/{dayOfTheMonth}") public String show( ModelMap model, @PathVariable Integer year, @PathVariable Integer month, @PathVariable Integer dayOfTheMonth ){ .... var editEntryForms =

Spring Boot and Thymeleaf - “a href”s to another sites going into 404 error

若如初见. 提交于 2020-05-17 06:07:07
问题 I have created a spring-boot-starter-thymeleaf project version 2.2.6-RELEASE with IntelliJ version 2020.1. Unfortunately, I do not know why the links in the thymeleaf templates are not referring to the next ones. When I start the project and type "localhost:8080" in my web browser the index.html site is visible. After clicking a "a href" inside the index.html , the web browser shows me the url e.g. "localhost:8080/product.html" with an 404 error. Heres the project structure: Project structure

Consider defining a bean named 'entityManagerFactory' in your configuration-Spring boot

守給你的承諾、 提交于 2020-05-16 20:29:48
问题 following is my code Spring boot Entry class @SpringBootApplication @EnableJpaRepositories("com.test.assertmanagementdigital4.repositories") @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class}) @ComponentScan("com.test.assertmanagementdigital4") public class AssertManagementDigital4Application { public static void main(String[] args) { SpringApplication.run(AssertManagementDigital4Application.class, args); } } Controller @RestController

Spring MVC request Mapping Class level

我的梦境 提交于 2020-05-16 13:33:11
问题 I have made a small spring mvc app. In my controller i have 2 methods which returns the names of the jsp files in the web-inf folder. Now the application works perfectly, but if i try to add a url path it doesn't work. What i mean is something like this: @Controller @RequestMapping("/start") //if add this it doesn't work public class SalesController { @RequestMapping(value = "/greeting") public String sayGreeting(Model model) { model.addAttribute("greetingMsg", "Hello Spring"); return

Spring MVC request Mapping Class level

夙愿已清 提交于 2020-05-16 13:32:14
问题 I have made a small spring mvc app. In my controller i have 2 methods which returns the names of the jsp files in the web-inf folder. Now the application works perfectly, but if i try to add a url path it doesn't work. What i mean is something like this: @Controller @RequestMapping("/start") //if add this it doesn't work public class SalesController { @RequestMapping(value = "/greeting") public String sayGreeting(Model model) { model.addAttribute("greetingMsg", "Hello Spring"); return

How to use @RequestBody and @RequestParam together

余生颓废 提交于 2020-05-16 08:57:29
问题 I'm trying to use both @RequestBody and @RequestParam to send JSON and multiple files through Postman but it's not working. Is it possible to use both annotations in an API? @RequestMapping(value = "/save/product/test", method = RequestMethod.POST) public ResponseEntity<?> save(@Valid @RequestBody ProductVo productVo, @RequestParam("files") @NotNull @NotBlank MultipartFile[] uploadfiles) { System.out.println("body " + productVo.toString()); for (MultipartFile file : uploadfiles) { System.out