Steps to use:
1. Creating MAVEN Web Project projects
2. Add dependencies in the Pom.xml file
<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xsi:schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" > <modelversion>4.0.0</ Modelversion> <groupId>com.wyl</groupId> <artifactId>SpringbootJSP</artifactId> < packaging>war</packaging> <version>0.0.1-SNAPSHOT</version> <name>springbootjsp Maven Webapp</name> <url>http://maven.apache.org</url><properties> <java.version>1.7</java.version> </properties> <parent> <group Id>org.springframework.boot</groupid> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.3.RELEASE</version> </parent> <dependencies> <dependency> <group Id>junit</groupid> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupid>org.springframewor K.boot</groupid> <artifactId>spring-boot-starter-web</artifactId> </dependency><!--introducing Tomcat-dependent<dependency> <groupId>org.springframework.boot</groupId> <artifactid>spring-boot-sta Rter-tomcat</artifactid> <scope>provided</scope> </dependency><!--tomcat-jasper --<dependency> <groupId>org.apache.tomcat</groupId> <artifactid>tomcat-jasper</arti Factid> <version>9.0.0.M21</version> </dependency><!--introduction of servlet dependency --<dependency> <groupId>javax.servlet</groupId> <artifactid>javax.servlet-api</arti factid> <version>4.0.0-b07</version> <scope>provided</scope> </DEPENDENCY&G T<!--Introducing JSTL Tag Library --<dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency><!--devtools plug-in, hot deployment--<dependency> <groupId>org.springframework.boot</groupId> <artifactid>spring-boot-dev Tools</artifactid> <optional>true</optional> <scope>true</scope> </dependency> </dependencies> <!--packaging Plugins--<build> <finalname> ; springbootjsp</finalname> <plugins> <plugin> <groupid>org.springframewo Rk.boot</groupid> <artifactId>spring-boot-maven-plugin</artifactId> <config Uration> <fork>true</fork><!--Thermal deployment takes effect must be added to </configuration> </plugin> </plugins> & Lt;/build></project>
3. Configure Application.properties Support JSP
spring.mvc.view.prefix=/web-inf/jsp/spring.mvc.view.suffix=.jsp
4. Write test controller
@Controller Public class Jspcontroller { @RequestMapping ("indexjsp") Public String index (map<string, Object> map) { map.put ("Hello", "there is JSP"); return "index"; The map is/web-inf/jsp/index.jsp page }}
5. Write JSP page
<%@ page language= "java" contenttype= "text/html; Charset=utf-8 " pageencoding=" Utf-8 "%><! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" > helloJsp ${ Hello}</body>
Spring Boot Primer-using JSP