0

When I use @GetMapping("/index") CSS and JavaScript files load properly.

But when I use @GetMapping("/admin/index") CSS and JavaScript files don't load properly.

Works fine for

@GetMapping("/index")
public String indexPage()
{
    return "index";
}

Not working for

@GetMapping("/admin/index")
public String indexPage()
{
    return "index";
}

Project structure is

enter image description here

JSP Page

enter image description here

4
  • Please share the 404 error you see in the BROWSER console. Commented Jan 13, 2019 at 5:31
  • bootstrap.min.css:1 Failed to load resource: the server responded with a status of 404 () Commented Jan 13, 2019 at 5:53
  • problem occurs while using @GetMapping("/admin/index"). Works fine while using @GetMapping("/index") Commented Jan 13, 2019 at 5:55
  • could you post your ressource mapping here , Commented Jan 13, 2019 at 9:28

1 Answer 1

1

JS and CSS files are requested from the browser relatively to the current location. That means that if you are:

If you want to use your second mapping @GetMapping("/admin/index"), you should request your JS and CSS differently in the JSP

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

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.