title: How to serve static content from tomcat
body: <p>I have a directory containing a number of static file (*.png, *.css, etc).<br>
  I thought (mistakenly perhaps) that just creating a directory in my application's WEB-INF file would suffice and I would be able to access the files by just referring to them by name:<br>
  Ex:</p>
  
  <pre><code>   &lt;link rel="stylesheet" href="/static/styles.css" type="text/css"&gt;
  </code></pre>
  
  <p>My directory structure is as follows:</p>
  
  <pre><code>+WEB-INF
     |
     +---static
         |
         +--styles.css
         +--header.png
  </code></pre>
  
  <p>My web.xml is as follows</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  &lt;web-app xmlns="http://java.sun.com/xml/ns/j2ee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
  version="2.4"&gt;
  &lt;display-name&gt;myapp&lt;/display-name&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;classpath:com/example/myapp/spring/applicationContext.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;listener&gt;
          &lt;listener-class&gt;
              org.springframework.web.context.ContextLoaderListener
          &lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;listener&gt;
          &lt;listener-class&gt;
              com.example.myapp.ContextListener
          &lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;!--  
          There are three means to configure Wickets configuration mode and they are
          tested in the order given. 
          1) A system property: -Dwicket.configuration
          2) servlet specific &lt;init-param&gt;
          3) context specific &lt;context-param&gt;
          The value might be either "development" (reloading when templates change)
          or "deployment". If no configuration is found, "development" is the default.
      --&gt;
  
      &lt;filter&gt;
          &lt;filter-name&gt;wicket.myapp&lt;/filter-name&gt;
          &lt;filter-class&gt;org.apache.wicket.protocol.http.WicketFilter&lt;/filter-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;applicationFactoryClassName&lt;/param-name&gt;
              &lt;param-value&gt;org.apache.wicket.spring.SpringWebApplicationFactory&lt;/param-value&gt;
          &lt;/init-param&gt;
      &lt;/filter&gt;
      &lt;filter&gt;
          &lt;filter-name&gt;wicket.session&lt;/filter-name&gt;
          &lt;filter-class&gt;org.apache.wicket.protocol.http.servlet.WicketSessionFilter&lt;/filter-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;filterName&lt;/param-name&gt;
              &lt;param-value&gt;wicket.myapp&lt;/param-value&gt;
          &lt;/init-param&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;wicket.myapp&lt;/filter-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;wicket.session&lt;/filter-name&gt;
          &lt;url-pattern&gt;/servlet/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>But....<br>
  This doesn't work I just get a 404 - file not found when attempting to access the resources contained in the "static" directory. Is there something I'm missing here?</p>