Streamline your flow

Java Return Html Page Using Restcontroller In Spring Boot Stack

Java Return Html Page Using Restcontroller In Spring Boot Stack
Java Return Html Page Using Restcontroller In Spring Boot Stack

Java Return Html Page Using Restcontroller In Spring Boot Stack To return the html page (view), you have to use spring mvc, i.e. @controller instead of @restcontroller and return modelandview with index as a view name: @getmapping(path = {"mainpage"}) public modelandview index() { final var modelandview = new modelandview(); modelandview.setviewname("index"); return modelandview; other methods. thank you!. However, sometimes there is a need to return html pages, which the server can dynamically generate. in spring boot, we can configure a controller that handles requests and renders html pages using the thymeleaf template.

Java How Return Html Page In Spring Boot Without Thymeleaf Stack
Java How Return Html Page In Spring Boot Without Thymeleaf Stack

Java How Return Html Page In Spring Boot Without Thymeleaf Stack In this tutorial, we want to have a look at how to return html from a spring mvc controller. let’s take a look at what needs to be done. 2. maven dependency. first, we have to add the spring boot starter web maven dependency for our mvc controller: 3. controller. next, let’s create our controller:.

Java How Return Html Page In Spring Boot Without Thymeleaf Stack
Java How Return Html Page In Spring Boot Without Thymeleaf Stack

Java How Return Html Page In Spring Boot Without Thymeleaf Stack

Comments are closed.