0

I'm having difficulty importing my CSS files with spring 4

First i tried this in index.html

<link  href="../../resources/css/bootstrap.min.css" rel="stylesheet">

Eclipse did not acknowledge any errors, but when I run the application the css does not load on the page

After searching i did this

registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");

And in index.html I left it like that, and it worked

<link  href="resources/css/bootstrap.min.css" rel="stylesheet">

But the eclipse says there is an error look this

my classpath

statics

@Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/*.html").addResourceLocations("/WEB-INF/html/");
        registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
        super.addResourceHandlers(registry);
    }
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController( "/" ).setViewName( "forward:/index.html" );

    }

1)What is the correct way to import CSS and JS and spring 4?

2)Why the first way did not work? using ../../

3)How to import without eclipse accuse error?

thanks guys^^

1 Answers1

0

To My previous knowledge and errors make sure you are defining the correct directory and adding the right links. Hope that helped if not I am sorry.

Akhil
  • 65
  • 1
  • 1
  • 9