关于springBoot项目的jsp页面访问
创建springBoot项目后:
然后在src/main/webapp目录下新建WEB-INF/jsp目录
然后在pom文件中加入jsp的必要依赖:
<!-- jsp必要依赖 -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>3.0-alpha-1</version>
<scope>provided</scope>
</dependency>
在/WEB-INF/jsp/目录下创建jsp文件:(编码改为utf-8)
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Insert title here</title>
</head>
<body>
我是一个jsp页面
</body>
</html>
创建controller:
运行项目: