上个章节咱们讲了web页面开发的Thymeleaf开发。
如今咱们就须要说一下咱们之前经常使用的JSP页面开发了,由于JSP没法实现Spring Boot的多种特性,因此Spring Boot不推荐使用JSP进行页面开发。html
<!--WEB支持--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!--jsp页面使用jstl标签--> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> </dependency> <!--用于编译jsp--> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> <scope>provided</scope> </dependency>
#这里是端口号 server.port=8088 spring.mvc.view.prefix=/WEB-INF/jsp/ spring.mvc.view.suffix=.jsp
index.jsp页面内容:java
<%@ page 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"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>测试页面</title> </head> <body> <h1>HELLO WORLD!!!</h1> </body> </html>