Domo is Fugito.
This time is a memorandum of rudimentary errors. Specifically, "Using Spring Boot and Thymeleaf, "Hello World" at http: // localhost: 8080 I met when prototyping an MVC application to display It is a record of "Handling the whitelabel error page".
I made it according to the article of here. Start the server according to the article as it is, go to the localhost page ....
I forgot to take a screenshot, but I immediately encountered an error page. If you take a closer look "This application has no explicit mapping for /error" And that. HM?
Apparently it's an error that tends to get hooked. But "Try adding Thymeleaf to your dependencies" etc. Congratulations on what you're doing ... sweat Do I have to ask this question myself ...?
With HelloController.java created by myself I found a difference by comparing it with the controller source listed in this article.
package com.example.web;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@RequestMapping("")
@Controller
public class PortalController {
@RequestMapping("")
public String index() {
System.out.println("aaa");
return "home";
}
}
package com.example.demo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class HelloController {
@RequestMapping("/")
public ModelAndView index(){
ModelAndView model = new ModelAndView();
model.setViewName("index");
return model;
}
}
** RequestMapping annotation before Controller annotation I can't attach it. ** **
Maybe this is ...?
Added Request Mapping with half confidence. Then ...
Recommended Posts