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