Unable to upload images to freemarker template

I am very new to using Dropwizard and Freemarker template. I am trying to download a free marker template. However, images are not displayed on the displayed page.

I am using standard html img tags to display images

<img src="/media/images/mload.png" width="18" height="18" />

      

The images are available in the jar file.

Here is the project structure

Center for Contemporary Art | - main | --Resources | - Media | --- images | --- mload.png

kindly let me know if something is missing to display the image

+3


source to share


1 answer


From the official documentation :

AssetBundle

provides an easy way to serve static assets from your services src/main/resources/assets

as files available from /assets/*

within your service.



You need to add AssetBundle

to your service with:

@Override
public void initialize(Bootstrap<HelloWorldConfiguration> bootstrap) {
    bootstrap.setName("hello-world");
    bootstrap.addBundle(new AssetsBundle());
}

      

+3


source







All Articles