Search code examples
htmlerrai

How to put a static local image in html template in Errai Framework?


I have html template, and I would like to use inside an image as follow:

<img src="img/Avatar.png">

I use errai in version: 4.0.0.CR1. I've checked documentation, but there is no word about it. What path should be set for local image's in template file? Please help.


Solution

  • No magic. The path is related to your root document. I mean index.jsp or index.html. So you can simply use relative or absolute path to your image as for regular web page.

    Let's assume your app starts like this: http://127.0.0.1:8888/. Then simply "/img/Avatar.png" should work fine.

    If your app starts like this: http://127.0.0.1:8888/App/, then simply "/App/img/Avatar.png".

    But of course I would recommend properly resolved relative path.