java jsp中写的图片路径如何在前端页面显示
不用再jsp中加入任何代码,只需
在springmvc-config.xml配置文件中加入
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
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-4.3.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd ">
<mvc:annotation-driven/>
<mvc:resources location="/img/" mapping="/img/**"/>
</beans>
img为WebContent文件夹下的文件名称,然后就可以显示图片了
jsp:
<img src="img/123.jpg" width="100px" height="50px">
<span id="">在线销售平台</span>
显示: