This tutorial will walk you through the process of creating a Handling From Submission Example with Spring Boot and FreeMarker.

What you'll build

What you'll need

  • JDK 1.7+
  • Maven 3+

Stack

  • Java
  • Spring Boot
  • FreeMarker
  • HTML, CSS

Init project structure and dependencies

Project structure

├── src
│   └── main
│       ├── java
│       │   └── com
│       │       └── hellokoding
│       │           └── springboot
│       │               ├── FormController.java
│       │               ├── User.java
│       │               └── WebApplication.java
│       └── resources
│           ├── static
│           │   ├── css
│           │   │   └── main.css
│           │   └── js
│           │       └── main.js
│           ├── templates
│           │   └── form.ftl
│           └── application.properties
└── pom.xml

Project dependencies


Define DTO, Controller and View Template

Data Transfer Object (DTO)


Controller


View template


Config and Run

Application Configuration



Run the application

Type the following command on the terminal at your project root directory

mvn clean spring-boot:run

Source code

https://github.com/hellokoding/hellokoding-courses/tree/master/springboot-examples/springboot-freemarker-form-submission