grails无法在列表视图中显示图像

时间:2013-08-30 08:11:39

标签: grails

我想在grails项目的列表视图中显示图像

我在控制器中写了一个动作,用于在列表中显示它

def showImage () {
    def testUnitInstance = TestUnit.get(params.testUnitId)
    response.setContentType("image/jpeg")
    response.setContentLength(testUnitInstance.image.size())
    response.outputStream << testUnitInstance.image
    response.outputStream.flush()
    }
列表视图中的

我已经调用了该操作

<img src="<g:createLink controller='testUnit' action='showImage' 
                    params='[testUnitId:testUnitInstance.id]'/>" height="14px" width="14px" alt="img"
                                    style="padding-left: 20px;"/>

但仍然没有显示图像,有人建议我这个解决方案

0 个答案:

没有答案
相关问题