diff --git a/spring-boot-modules/spring-boot-jsp/src/main/java/com/baeldung/boot/jsp/SpringBootJspApplication.java b/spring-boot-modules/spring-boot-jsp/src/main/java/com/baeldung/boot/jsp/SpringBootJspApplication.java index c77554f9f6..98122bed50 100644 --- a/spring-boot-modules/spring-boot-jsp/src/main/java/com/baeldung/boot/jsp/SpringBootJspApplication.java +++ b/spring-boot-modules/spring-boot-jsp/src/main/java/com/baeldung/boot/jsp/SpringBootJspApplication.java @@ -8,6 +8,8 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer @SpringBootApplication(scanBasePackages = "com.baeldung.boot.jsp") public class SpringBootJspApplication extends SpringBootServletInitializer { + + //comment below if deploying outside web container --> @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { return builder.sources(SpringBootJspApplication.class); diff --git a/spring-boot-modules/spring-boot-jsp/src/main/java/com/baeldung/boot/jsp/controller/HomeController.java b/spring-boot-modules/spring-boot-jsp/src/main/java/com/baeldung/boot/jsp/controller/HomeController.java new file mode 100644 index 0000000000..7d7b9c3cbd --- /dev/null +++ b/spring-boot-modules/spring-boot-jsp/src/main/java/com/baeldung/boot/jsp/controller/HomeController.java @@ -0,0 +1,15 @@ +package com.baeldung.boot.jsp.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +@RequestMapping("/") +public class HomeController { + + @GetMapping("") + public String index() { + return "index"; + } +} diff --git a/spring-boot-modules/spring-boot-jsp/src/main/webapp/WEB-INF/jsp/index.jsp b/spring-boot-modules/spring-boot-jsp/src/main/webapp/WEB-INF/jsp/index.jsp new file mode 100644 index 0000000000..87b6beaf26 --- /dev/null +++ b/spring-boot-modules/spring-boot-jsp/src/main/webapp/WEB-INF/jsp/index.jsp @@ -0,0 +1,10 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> + +
+