Dropwizard Tutorial : HTML Page Using Freemarker


Before you start this, Its good to follow the following articles.

Running Rest API using Dropwizard

Reading From Database Using Dropwizard 

Writing To Database Using Dropwizard

I will assume that your dropwizard project is running.


Add dependency of dropwizard-freemarker-views in your pom.xml

Your pom.xml should look like this:

Freemarker Template Language

Apache FreeMarker™ is a template engine. It’s a Java library to generate text output based on templates and data. Templates are written in the FreeMarker Template Language (FTL), which is a simple and specialized language. Template allows us to focus on how to present the data. Outside the template you are focusing on what data to present.

Further reading here.

Template Configuration Context

Hello World FTL

Add a directory at src level and add helloWorld.ftl

Hello World GET API

Add a get API to render HelloWorld FTL in browser

Run The Project

Open the API in the browser to see your helloWorld rendered.

Screen Shot 2018-07-19 at 3.30.13 PM.png

Further Reading:



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: