Search code examples
springspring-mvcsitemesh

Sitemesh spring mvc access to the resources in decorator


I have a problem with import css files in decorator.jsp file. My files structure looks following:

WEB-INF
    css
        style.css
    decorators
        decorator.jsp

How can I access style.css? I tried with different combinations an still didn't get effect.

<link rel="stylesheet" href="../css/style.css" />
<link rel="stylesheet" href="/WEB-INF/css/style.css" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css" />

However contextPath, servletPath, pathInfo always returns null. Thanks in advance for any help.


Solution

  • Try the below:

    <link href="/css/style.css" rel="stylesheet" type="text/css" />
    

    I have pretty much the same structure as you and the above works...