为什么我的图像没有显示在我的SpringWebFlow项目中
为什么我的图像没有显示在SpringWebFlow项目中 我的jsp页面中有以下代码为什么我的图像没有显示在我的SpringWebFlow项目中,spring,spring-mvc,spring-webflow,Spring,Spring Mvc,Spring Webflow,为什么我的图像没有显示在SpringWebFlow项目中 我的jsp页面中有以下代码 <img src="<c:url value="/images/getacro.gif" />" alt="Get Adobe Reader" align="top" height="31" width="88"> “alt=“Get Adobe Reader”align=“top”height=“31”width=“88”> 但是,在我的Spring webflow项目中,该图像没
<img src="<c:url value="/images/getacro.gif" />" alt="Get Adobe Reader" align="top" height="31" width="88">
“alt=“Get Adobe Reader”align=“top”height=“31”width=“88”>
但是,在我的Spring webflow项目中,该图像没有显示在网页上。因此,我检查了我的tomcat服务器,并在中看到了该图像:
apache-tomcat-7.0.29/webapps/Enroll/images
但是我检查了日志,在日志中看到404错误:
[12/Oct/2012:15:04:13-0400]“GET/Enroll/images/getacro.gif HTTP/1.1”404 952
但是它在文件系统上。它可能是什么..我想这是我的spring设置
这是我的mvc.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<mvc:annotation-driven />
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"
p:basenames="messages" />
<!-- Declare the Interceptor -->
<mvc:interceptors>
<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"
p:paramName="locale" />
</mvc:interceptors>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
这是我的web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>Enroll</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-config.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value></param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Resource Servlet</servlet-name>
<servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>
</servlet>
<!-- Map all /resources requests to the Resource Servlet for handling -->
<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>
<!-- Spring Security Configuration -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
登记
index.html
index.htm
index.jsp
default.html
default.htm
default.jsp
上下文配置位置
/WEB-INF/spring/root-config.xml
org.springframework.web.context.ContextLoaderListener
春天
org.springframework.web.servlet.DispatcherServlet
上下文配置位置
1.
春天
/
资源Servlet
org.springframework.js.resource.ResourceServlet
资源Servlet
/资源/*
springSecurityFilterChain
org.springframework.web.filter.DelegatingFilterProxy
springSecurityFilterChain
/*
从您的配置文件中,由于您有一个资源servlet,我想说试试
“alt=“Get Adobe Reader”align=“top”height=“31”width=“88”>
检查web.xml文件中的映射。或者在spring配置文件中。。不,不是那样的。我想我的SpringWebFlow设置中有什么东西停止了它。您是否尝试在浏览器中粘贴完整的URL,并检查图像是否正确显示/Enroll是您的上下文根目录吗?Spring Dispatcher Servlet拥有/*(除了/resources/*)。因此,图像不起作用也就不足为奇了。我同意你需要参考/资源/图片或采取不同的方法。您是否已键入/Enroll/resources/images/getacro.gif以查看是否至少这样做有效?在任何情况下,我不认为这将是您的Webflow配置。不起作用:(