如何使用angularjs和spring从图像路径获取图像

时间:2018-04-11 11:35:54

标签: angularjs spring spring-mvc

我已将图像存储在文件夹及其在db中的路径,而我试图使用angularjs和spring在jsp页面中显示存储的图像。它抛出以下错误

  

“不允许加载本地资源:file:/// D:/ RentdUpload / Images / 2/5 / 68_xc90(3).jpg。”

如何解决错误并从本地文件夹中获取图像。 提前致谢

1 个答案:

答案 0 :(得分:0)

的applicationContext.xml

  

在applicationContext.xml

中配置存储图像的路径
<mvc:resources mapping="/images/**" location="file:///C:/Upload/Images/"/>

Temp.jsp

  

使用以下方法

在jsp中调用保存文件夹中的图像
<img ng-src="<c:url value="images/{{uploadproductImage1? uploadproductImage1: 'resources/products/assets/images/picture.svg'}}"/>">
相关问题