Reputation: 5611
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.
The WEB-INF structure is:
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?
Upvotes: 0
Views: 180
Reputation: 14551
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.
Upvotes: 2