Can't serve static content out of Struts2
I have a simple Struts2 app that is serving JSP files just fine. But when I try to serve CSS files, I get 404
.
Here is my web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<session-config>
<session-timeout>
30
开发者_开发技巧 </session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
In my WEB-INF I have a content
folder where I serve JSP files (using the convention plugin). I tried putting a css\application.css
folder/file in both the content
and web-inf
root directly. Neither work.
Any tips would be appreciated.
Thanks
Nevermind. I figured it out. I had the folder in the wrong location.
It needed to be directly in the web folder and not WEB-INF.
Dur...
精彩评论