Abd*_*dul 1 spring jsp spring-mvc tiles2
我对春天很新。我使用的是Spring 3.29版本的tomcat7。我需要在.jsp文件中显示图像。我搜了很多。有关此问题的文章很多。但是我仍然无法解决这个问题。请帮忙。
以下是我的应用程序结构
以下是我的spring-servlet.xml文件代码
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">
<context:component-scan base-package="com.wipro.controller" />
<bean id="viewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass">
<value>
org.springframework.web.servlet.view.tiles2.TilesView
</value>
</property>
</bean>
<bean id="tilesConfigurer"
class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/tiles.xml</value>
</list>
</property>
</bean>
</beans>
Run Code Online (Sandbox Code Playgroud)
我有一个footer.jsp页面。我需要在此文件中添加图像,下面是代码
<!-- Here I need to add an image -->
<hr/>
<p>Copyright 2010-2014 javatpoint.com.</p>
Run Code Online (Sandbox Code Playgroud)
我在页面中找到了图片。@Pankaj Saboo的评论很有帮助。谢谢大家
我在spring-servlet.xml中添加了以下代码
<mvc:annotation-driven />
<mvc:resources mapping="/images/**" location="WEB-INF/resources/images/" />
Run Code Online (Sandbox Code Playgroud)
在footer.jsp中,我添加了以下代码
<img src="<c:url value="/images/wipLogo.png" />"/>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7632 次 |
| 最近记录: |