This tutorial walks you through the steps of creating a Hello World web app example with Spring Boot and JSP.

What you'll build

What you'll need

  • JDK 8+ or OpenJDK 8+
  • Maven 3+

Init project structure and dependencies

Project structure

├── src
│   └── main
│       ├── java
│       │   └── com
│       │       └── hellokoding
│       │           └── springboot
│       │               └── view
│       │                   ├── Application.java
│       │                   └── HelloController.java
│       ├── resources
│       │   ├── static
│       │   │   ├── css
│       │   │   │   └── main.css
│       │   │   └── js
│       │   │       └── main.js
│       │   └── application.properties
│       └── webapp
│           └── WEB-INF
│               └── jsp
│                   └── hello.jsp
└── pom.xml

Project dependencies


Define Controller and View Template

Hello Controller

Controller maps HTTP Requests with View.


@RequestMapping maps /hello request to hello() method.

name is a query string parameter of /hello request.

Model object passes value to hello view (hello.jsp).

View Template


Static files



Config and Run

Application Configurations



Run with Maven

Type this bash command at the example root directory and visit to localhost:8080

mvn clean spring-boot:run

Source code

https://github.com/hellokoding/hellokoding-courses/tree/master/springboot-examples/springboot-jsp-helloworld