Awesome Open Source
Awesome Open Source


Day 5 - Spring Boot - Hello World Example with JSP

In this tutorial you will know how to create Hello World Example with JSP in Spring Boot in simplest way.

Project Structure

Let’s Setup Environment

  1. Maven 3 and any latest version
  2. JDK 1.6 / JDK 1.7 / JDK 1.8 / JDK 1.9
  3. Eclipse Kepler / Eclipse Juno / Eclipse Neon

1. Got to and select dependencies Web for your project.

2. Extract that project and import in eclipse.

File > Import > Existing Maven Projects > Click Next > Select project root directory > Click Finish

3. Add Extra dependencies in pom.xml file

	<!-- JSTL for JSP -->
	<!-- Need this to compile JSP -->

4. Add project configuration properties in src/main/resources/ file

# jsp view binding configuration 

# project context and port configuration

5. Add Controller Class in src/main/java/package/ file

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

public class HomeController {

	@RequestMapping(value = "/", method = RequestMethod.GET )
	public String hello(Model model){
		model.addAttribute("title", "Spring Boot - Hello World Example Jsp");
		return "index";

6. Add JSP view in webapp/WEB-INF/jsp/index.jsp file

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="spring" uri=""%>
<%@ taglib prefix="c" uri=""%>

<!DOCTYPE html>

That's are ready to Run

Right click to project > Run As > Spring Boot App

go to http://localhost:8080/springboot-helloworld/


Rutvik Patel - [email protected]

Distributed under the GPL V3.0 license. See LICENSE for more information.

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Java (696,382
Shell (228,885
Spring Boot (12,391
Web (7,763
Spring (5,016
Example (4,704
Maven (3,233
Jsp (657
Hello World (546
World (204
J2ee (147
Spring Web (93
Hello (75
Rutvik (7
Rutvikrpatel (7
Related Projects