This post walks you through the steps of creating a Form Data Binding and Validation Example with Java, Spring Boot and FreeMarker.

What you'll build

What you'll need

  • JDK 1.7+
  • Maven 3+

Stack

  • Java
  • Spring Boot
  • FreeMarker
  • HTML, CSS

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


Data transfer object


Controller


View template


Application Configuration



Run the application

mvn clean spring-boot:run

Source code

[email protected]:hellokoding/form-databinding-validation-java-springboot-freemarker.git

https://github.com/hellokoding/form-databinding-validation-java-springboot-freemarker