1

我的项目文件结构在我不知道可能导致错误的原因:

src
test
db
war/
   WEB-INF/
          classes
          css/
             fancybox/
                     jquery.fancybox.css
          images/
                fancybox/
                        fancybox_sprite.png
          js
          lib
          tld
          applicationContext.xml
          servlet.xml
          web.xml
    index.jsp

jquery.fancybox.css 有

#fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span {

    background-image:url(../../images/fancybox/fancybox_sprite.png)
}

我也收到来自萤火虫的错误:

GET fancybox_sprite.png 404 未找到文件 GET fancybox_loading.gif 404 未找到文件 GET fancybox_overlay.png 404 未找到文件

Web.xml

<?xml version="1.0" encoding="UTF-8"?>

<web-app
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    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_3_0.xsd"
    id="crimeTrack" version="3.0">

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <context-param>
         <param-name>log4jConfigLocation</param-name> 
         <param-value>/WEB-INF/classes/log4j.properties</param-value>
     </context-param>
     <listener> <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>  </listener> 

     <listener>
          <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> 
     </listener>

     <listener>
          <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
     </listener> 

    <servlet>
        <servlet-name>crimetrack</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>crimetrack</servlet-name>
        <url-pattern>*.htm</url-pattern>
    </servlet-mapping>


    <welcome-file-list>
    <welcome-file>
      index.jsp
    </welcome-file>
    </welcome-file-list>

    <jsp-config>
        <taglib>
            <taglib-uri>/spring</taglib-uri>
            <taglib-location>/WEB-INF/tld/spring-form.tld</taglib-location>
        </taglib>
    </jsp-config>

</web-app>
4

1 回答 1

2

如果您的 css 包含在某处,则您的路径必须来自此文件。不是来自CSS。如果它包含在index尝试中background-image:url(images/fancybox/fancybox_sprite.png)

于 2012-10-23T19:54:00.087 回答