SpringBoot实现支持jsp

版权声明:互相学习,共同进步!! https://blog.csdn.net/hello_word2/article/details/82979499

pom文件 

<dependencies>
	<dependency>
		<groupId>org.apache.tomcat.embed</groupId>
		<artifactId>tomcat-embed-jasper</artifactId>
	</dependency>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-web</artifactId>
	</dependency>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-test</artifactId>
		<scope>test</scope>
	</dependency>
	<dependency>
		<groupId>javax.servlet</groupId>
		<artifactId>jstl</artifactId>
	</dependency>
	<dependency>
		<groupId>com.fasterxml.jackson.core</groupId>
		<artifactId>jackson-core</artifactId>
		<version>2.9.6</version>
	</dependency>
	<dependency>
		<groupId>com.google.code.gson</groupId>
		<artifactId>gson</artifactId>
		<version>2.8.5</version>
	</dependency>
</dependencies>

创建目录、添加jsp文件
         1创建目录webapp->WEB-INF->jsp(注意webapp目录在main目录下,与java、resources目录同级)
         2如何在idea中直接创建jsp文件:
            File->Project Structure->Modules->选中要创建jsp的项目->点击添加按钮,查找Web并选中

运行项目
注意:直接运行main方法无法访问jsp。
解决办法:使用插件启动

猜你喜欢

转载自blog.csdn.net/hello_word2/article/details/82979499