Karthik Ramasamy
Karthik Ramasamy

Reputation: 35

How to map user defined web page url to specific html in spring boot?

localhost:8080/company/home => Will Open home.html (say it is located in ../resources/static/) localhost:8080/company/userdetails => user.html

I have seen a lot of online resources. But I couldn't understand clearly. Please someone help me !

Upvotes: 0

Views: 319

Answers (1)

Seldo97
Seldo97

Reputation: 719

Simple example for home.html:

@Controller
public class HomePageController {

    @GetMapping("/company/home")
    public String openHomePage() {


        return "home"; // it is your home.html in your /resources/static folder.
    }

}

Upvotes: 1

Related Questions