2

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.

luke
  • 3,531
  • 1
  • 26
  • 46

1 Answers1

0

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...

Rob Garwood
  • 108
  • 3
  • I would try moving your css out of WEB-INF, so it isn't under teh control of spring. Move it to the same directory level as WEB-INF and you should be able to access it. – Rob Garwood Aug 01 '13 at 08:57
  • Actually, looking at my project, my style stuff isn't in WEB-INF. Digging a little deeper on here, I found [this](http://stackoverflow.com/questions/2231792/including-style-sheet-in-a-jsp-page-with-spring-mvc) which explains it much better than i do. – Rob Garwood Aug 01 '13 at 09:00
  • Many thanks! Putting and with proper attributes in bean definition resolved this problem. – luke Aug 01 '13 at 09:29