一领突、SpringBoot整合jsp
1荐健、創(chuàng)建SpringBoot項(xiàng)目
2酱畅、導(dǎo)入maven依賴
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- web項(xiàng)目依賴 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<!-- jsp標(biāo)簽庫(kù) -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
3、配置application.properties
spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp
4江场、創(chuàng)建controller
@Controller
public class myController {
@RequestMapping("/index")
public String index(){
return "index";
}
}
5纺酸、創(chuàng)建jsp頁(yè)面放入src/main/webapp/WEB-INF/jsp/下