2011-04-07 145 views
0

我有一个简单的Struts2应用程序,它正在为JSP文件提供服务。但是当我尝试提供CSS文件时,我得到了404无法从Struts2提供静态内容

这里是我的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> 

在我的WEB-INF我有一个content文件夹,我所服务的JSP文件(使用约定插件)。我试图直接在contentweb-inf根目录中放置css\application.css文件夹/文件。既没有工作。

任何提示将不胜感激。

谢谢

回答

0

没关系。我想到了。我把文件夹放在了错误的位置。

它需要直接在网络文件夹中,而不是WEB-INF。

Dur ...