Hi Jazz I used to host css files outside of web-inf with the following configuration using spring mvc and some jstl, but this configuration, in my opinion, is general, so I hope this "should help you":
In web.xml add:
<servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.css</url-pattern> </servlet-mapping>
And in the page title, I link to the css file with the following code:
<%@page contentType="text/html" pageEncoding="UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> <head> <title></title> <link href="${pageContext.request.contextPath}/css/global.css" rel="stylesheet" type="text/css" /> </head>
Yours faithfully..
source share