0

In my Spring MVC 4 application, I have WEB-INF/html/include/imports.html file that has all the JavaScript and CSS, I should need throughout the application.

The author of this HTML Imports article suggests the use of a link tag on my HTML5 pages, like:

<link rel="import" href="include/imports.html" />

Where, on each page I use this tag, I'd need to adjust the relative path. So far, no news. I'm used to doing it on JSP.

So, I have this very simple login page, mapped on my controller as:

@RequestMapping(value = "/login", method = RequestMethod.GET)
public String loginPage() {
    return "login";
}

But whenever I try to load this login page, I get a console output of:

Apr 06, 2016 8:19:30 PM org.springframework.web.servlet.PageNotFound noHandlerFound
WARNING: No mapping found for HTTP request with URI [/hrm/include/imports.html] in DispatcherServlet with name 'dispatcher'

On Chrome's Developer Tools, I get this, saying it failed load the resource.

enter image description here

The WEB-INF structure is:

enter image description here

I don't really need this particular file mapped on my any controller, but I need it to be loaded by my pages.

What am I missing here?

2
  • Is the path to your html file correct? /htm/include/imports.html? It looks like the '/htm' may be where you are off. Commented Apr 6, 2016 at 22:31
  • @EricBellDesigns, the path is correct. I edited the question, providing further information. Commented Apr 6, 2016 at 23:26

1 Answer 1

2

You can put the file imports.html where your static resources are, in that case you don't need a dedicated mapping in a Controller, and the browser will be able to download it.

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.