小编str*_*sam的帖子

Grails 不会使用标签在子文件夹中显示图像

我在 Grails 项目中有图像文件,例如:

grails-app/assets/images/admin/img1.jpg
Run Code Online (Sandbox Code Playgroud)

我试图将其显示为:

<g:img dir="images/admin" file="img1.jpg">
Run Code Online (Sandbox Code Playgroud)

在开发环境(Grails 2.4)中,它没有出现。我得到 404。但是,如果我将图像复制到:

grails-app/assets/images/img1.jpg
Run Code Online (Sandbox Code Playgroud)

并更改如下代码:

<g:img dir="images" file="img1.jpg">
Run Code Online (Sandbox Code Playgroud)

有用。

我正在使用的插件:

build ":tomcat:7.0.55"
// plugins for the compile step
compile ":scaffolding:2.1.2"
compile ':cache:1.1.8'
compile ":asset-pipeline:1.9.9"

// plugins needed at runtime but not for compilation
runtime ":hibernate4:4.3.6.1" // or ":hibernate:3.6.10.18"
runtime ":database-migration:1.4.0"
runtime ":jquery:1.11.1"
Run Code Online (Sandbox Code Playgroud)

grails resources

3
推荐指数
1
解决办法
2307
查看次数

标签 统计

grails ×1

resources ×1