springboot学习总结四(Spring boot集成使用jsp)

1.Spring boot使用jsp需要在pom.xml加入依赖包:

springboot学习总结四(Spring boot集成使用jsp)

2.在application.properties文件配置spring mvc的视图展示为jsp

springboot学习总结四(Spring boot集成使用jsp)

3.在src/main下创建一个webapp目录,然后再该目录下新建jsp页面

build中要配置备注中的配置消息

<resources>

<resource>

<directory>src/main/java</directory>

<includes>

<include>**/*.xml</include>

</includes>

</resource>

<resource>

<directory>src/main/resources</directory>

<includes>

<include>**/*.*</include>

</includes>

</resource>

<resource>

<directory>src/main/webapp</directory>

<targetPath>META-INF/resources</targetPath>

<includes>

<include>**/*.*</include>

</includes>

</resource>

</resources>

举例:

JSPController.java

springboot学习总结四(Spring boot集成使用jsp)

index.jsp

springboot学习总结四(Spring boot集成使用jsp)