how do I configure a spring web app correctly?

I have a basic spring web app running on tomcat working ok. however, when I add an external stylesheet, I get a 404 error from tomcat. The web page displays but has no style.

jsp is in WEB-INF/jsp
css is in WEB-INF/jsp/css

I have tried
    <link  type="text/css" href="/css/gridStyle.css" rel="stylesheet"/>
    <link  type="text/css" href="css/gridStyle.css" rel="stylesheet"/>
    <link  type="text/css" href="/jsp/css/gridStyle.css" rel="stylesheet"/>
    <link  type="text/css" href="jsp/css/gridStyle.css" rel="stylesheet"/>

and when I try to view the css using web developer, it shows the path it is using as http://localhost:8081/<href path>

so it seems to me that I am missing some sort of configuration or context path, but I am new to intellij and don't know where to look.

Can anyone give me a pointer as to what I need to do, please?

Also, is there some sort of idiot's guide to developing web applications with intellij?

Thanks

2 comments
Comment actions Permalink

WEB-INF is private directory for web application. Files in it are not accessible from the web. You need to put your css dir elsewhere.

Usually structure is:

src/webapp/WEB-INF
src/webapp/css
src/webapp/javascript
etc.

Cheers,
Dragisa

0
Comment actions Permalink

That was it. Thank you, Dragisa.

0

Please sign in to leave a comment.