用于从文件夹加载图像的grails中未找到资源错误

时间:2014-04-30 10:38:18

标签: image grails groovy gsp

我正在建一家商店。在商店图像中将列出(Elastislide)作为类别。单击每个图像将引导另一个页面及其描述。所以我在每个类别中都有一组图像,例如appstore / uploads / images / category1。我的目标是将category1文件夹中的所有图像显示为elstislide列表。

以下是我在控制器appstore中的操作

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]
}

在我的商店gsp页面

<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>

在商店页面中没有加载图片,我收到以下错误..

| 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  - 

0 个答案:

没有答案