Gif image not working in thymeleaf-html page?

匆匆过客 提交于 2021-02-07 09:12:03

问题


in html image and gif are set as same way. so i use same way in thymeleaf

In thymeleaf the image set as

 <img th:attr="src=@{${ball.png}} , title=#{background}, alt=#{background}" style="width: 150px; height: 150px;" />

same as the gif image set as

<img th:attr="src=@{${run.gif}} , title=#{background}, alt=#{background}" style="width: 150px; height: 150px;" />

the image will show there but gif image not shows there

i don't know why this happening.

if you know the answer please share here.


回答1:


@{${run.gif}} tries to URL rewrite with the property gif of an attribute run, which I doubt there is.

You should do @{/run.gif} if you want to refer to the image relatively to your context.

Documentation: Thymeleaf URL Syntax



来源:https://stackoverflow.com/questions/19290665/gif-image-not-working-in-thymeleaf-html-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!