title: Serving static content with Struts2: Tomcat error 404
body: <p>With Struts2 I can't find a way to serve a static CSS :-/ Newbie question but I could not find any answer on the Internet:</p>
  
  <p>The CSS file is <code>static/styles.css</code> in my WAR file.</p>
  
  <p>Tomcat replies with 404 when I request <code>http://server/myapp/static/styles.css</code></p>
  
  <p>But it works if I put <code>styles.css</code> at the root of the WAR and request <code>http://server/myapp/styles.css</code></p>
  
  <p>I tried adding the following to my <code>struts.xml</code> in the only package but still 404:</p>
  
  <pre><code>&lt;action name="/static/*"&gt;
    &lt;result&gt;/static/{1}&lt;/result&gt;
  &lt;/action&gt;
  </code></pre>
  
  <p>Or as a second package:</p>
  
  <pre><code>&lt;package name="static" extends="struts-default" namespace="/static"&gt;
    &lt;action name="/static/*"&gt;
      &lt;result&gt;/static/{1}&lt;/result&gt;
    &lt;/action&gt;
  &lt;/package&gt;
  </code></pre>