P粉5936497152023-09-02 12:05:27
Do you use Spring? Spring Boot? JavaEE? I recommend using Spring Boot.
Spring Boot will automatically add static web resources located in any of the following directories:
/META-INF/resources/ /resources/ /static/ /public/
So you can create a public/
directory under the resources/
directory and put the static content there. They can then be accessed via http://localhost:3000/koo.htm. (Assume server.port
is 3000)
You can customize these directories using spring.resources.static-locations
in application.properties
.
You can continue reading: https://spring.io/blog/2013/12/19/serving-static-web-content-with-spring-boot