Image 资源未找到grails中从文件夹加载图像的错误
我正在建一家商店。在商店中,图像将被列为Elastislide类别。单击每个图像将引导另一个页面及其描述。因此,我在每个类别中都有一组图像,例如appstore/uploads/images/category1。我的目标是将category1文件夹中的所有图像显示为elstislide列表 以下是我在controller appstore中的操作Image 资源未找到grails中从文件夹加载图像的错误,image,grails,groovy,gsp,Image,Grails,Groovy,Gsp,我正在建一家商店。在商店中,图像将被列为Elastislide类别。单击每个图像将引导另一个页面及其描述。因此,我在每个类别中都有一组图像,例如appstore/uploads/images/category1。我的目标是将category1文件夹中的所有图像显示为elstislide列表 以下是我在controller appstore中的操作 def store() { def webRootDir = request.getContextPath() def serverU
def store() {
def webRootDir = request.getContextPath()
def serverUploadPath="uploads"
def imagePath="Image"
def imagesFolder = webRootDir + "/" + serverUploadPath + "/" +imagePath+"/"+"category1"
def imageList1 = new File(imagesFolder).list()
def imageList = Arrays.asList(imageList1)
println imageList
[imageList: imageList]
}
在我的商店普惠制页面
<h2>category1</h2>
<ul class="elastislide-list">
<g:each in="${imageList}" var="image">
<li>
<a href="javascript:">
<img src="${resource(dir: '/appstore/uploads/Image/category1', file: image)}" alt="image01"/>
</a>
<br>amma
</li>
</g:each>
</ul>
我假设在浏览器中转到/RITE/uploads/Image/category1/10.jpg会显示该图像?显示该图像的URL应该是什么?我相信这是你的问题-但是我给出的url是正确的..我在你的store方法的路径中看不到appstore。。。但它在gsp的资源调用中。。。
| Error 2014-04-30 16:00:26,359 [http-bio-8080-exec-3] ERROR resource.ResourceMeta - Resource not found: /RITE/uploads/Image/category1/1.jpg
| Error 2014-04-30 16:00:26,361 [http-bio-8080-exec-3] ERROR resource.ResourceMeta - Resource not found: /RITE/uploads/Image/category1/10.jpg
| Error 2014-04-30 16:00:26,362 [http-bio-8080-exec-3] ERROR resource.ResourceMeta - Resource not found: /RITE/uploads/Image/category1/11.jpg
| Error 2014-04-30 16:00:26,364 [http-bio-8080-exec-3] ERROR resource.ResourceMeta - Resource not found: /RITE/uploads/Image/category1/12.jpg
| Error 2014-04-30 16:00:26,366 [http-bio-8080-exec-3] ERROR resource.ResourceMeta - Resource not found: /RITE/uploads/Image/category1/13.jpg
| Error 2014-04-30 16:00:26,368 [http-bio-8080-exec-3] ERROR resource.ResourceMeta - Resource not found: /RITE/uploads/Image/category1/14.jpg
| Error 2014-04-30 16:00:26,370 [http-bio-8080-exec-3] ERROR resource.ResourceMeta -