1

My Maven Project Structure is Like Below.I want To Load Css In mainMenu.jsp File.

Folder Structure

<link rel="stylesheet" href="../Main.css">

Above Line Is Not Working.So How Can I Load Main.css in mainMenu?

3 Answers 3

1

Don't confuse your WEB-INF layout with what the browser sees. Move your Main.css to "webapp" (or, more commonly "webapp/style"), and then reference it as "Main.css" (if in webapp) or "style/Main.css" (if in webapp/style).

Under WEB-INF, you typically only want files which are processed server-side, eg. JSP (when using a ViewRenderer) or web.xml.

Sign up to request clarification or add additional context in comments.

Comments

1

Spring Boot automatically adds static resources located within any of the following directories as mentioned here:

/META-INF/resources/
/resources/
/static/
/public/

Hence, the mistake you are making is by placing static content in wrong directory.

Comments

0

I Have Solved Issue By Adding Below Line OF Code In Web Configuraion And Add All Front End File In resources Folder.

@Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry
            .addResourceHandler("/resources/**")
            .addResourceLocations("/resources/");
    }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.