Reputation: 415
This is my project content structure:
The spring boot applicaton, InternalResourceViewResolver
is pointed to the jsp resource:
This is the login.jsp, and the background tag can't load the image in WEB-INF/jsp/Image, but in spring boot application.java, I had pointed the resource. How can I get it?
Upvotes: 0
Views: 4317
Reputation: 1478
I had same issue. I understand that all static resources should be located in /resources/static or public location (as per Spring documentation) but it didn't work.
I implemented my own WebMvcConfigurerAdapter like this:
@Configuration
public class CustomResourceConfiguration extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**").addResourceLocations("");
}
}
Now it works. Hope it can help to somebody.
Upvotes: 0
Reputation: 848
The path of the image is relative to the URL, not relative to the location of the JSP. Try putting the image here: src/main/webapp/Images/LoginBg.jpg
Upvotes: 4