I have a maven project that I run using jetty:
$ mvn run:jetty
Where in my project should I be storing my static files like HTML, CSS, Javascript, images?
My layout is using a simple web app arch type:
/src/main/java/webapp/web-inf/views/
Should I just create a folder there named e.g. ‘assets’ ?
And then my view pages will reference the /assets folder somehow? I’m confused as to what path I will use in my html pages to reference an image like:
/assets/images/logo.png
This isn’t so much a Jetty question as it is a general Java webapp question. If you plan to serve them out directly (like *.css, *.css, images, etc), put them somewhere above
WEB-INFbut below your docroot. Java WebApps are all the following basic directory structure.Anything in
<docroot>is reachable directly through straight up http. AnythingWEB-INFand below is not. A really simple webapp with one page (index.jsp), one image in an images directory, and its configuration file (web.xml) would look like this.In index.jsp you could reference bob.jpg like…