How to display HTML page with Spring Boot and Spring Tool Suite
Vložit
- čas přidán 9. 07. 2024
- Learn how to display / render static HTML pages with Spring Boot in Spring Tool Suite.
👉 Help me reach my first 1k subscribers: / @jameskodes
We discuses which dependency you will need for your Spring Boot project. Where to save HTML pages, and you can use the controller to point to your HTML page. We will also create a default HTML error page and discuses how to you use default mapping for an index.html page.
If you run into issues with this or any other Java Spring Boot issues, let me know in the comments and I can help you out.
Chapters:
0:00 Intro
1:05 Dependencies
1:58 Controller for mapping to your page
3:34 Running project without html page
5:24 Create index.html
3:50 Create error.html
6:40 Using default mapping for an index.html
Want to learn Moring about Spring Boot!?!
• Learn Spring Boot
#sts #java #html
Nice work, easy to follow. Helped me a lot :D
This does work for basic controllers without spring security. Now I have to learn spring security via the filter chain
Code for Controller:
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class MainController {
@RequestMapping("/")
public String index() {
return "index";
}
}