Вопрос

I'm actually working on sending a notification mail in my Grails application.

the problem which I'm facing is that i need to have the absolute path of an image resource in order to have it appears in my mail

so in my mail template i used the following :

   ${resource(dir:"images" , file:"logo.png", absolute="true" ) }

but i'm always getting this instead of the full path to the resource

    static/images/logo.png

instead of

    http://localhost:8080/myApp/static/images/logo.png

how can i obtain the absolute url ?

Это было полезно?

Решение

You have a typo: absolute='true' instead of absolute: true.

So, correct:

${g.resource(dir:"images" , file:"logo.png", absolute: true ) }

If you use it in template, also try <g:resource dir="images" file="logo.png" absolute="true"/>

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top