SpringBoot框架
Spring公司
Spring | Home
整合JSP
1.需要配置web目录(或者叫webapp),放在src/main/web里面
2.安装JSP依赖(放在dependencies里面,千万不能放在dependencyManagement的dependencies的里面)
<!--?支持jsp的jar包?--> ?<dependency> ????????????<groupId>org.apache.tomcat.embed</groupId> ????????????<artifactId>tomcat-embed-jasper</artifactId> ????????????<scope>provided</scope> ????????</dependency> ????????<dependency> ????????????<groupId>jstl</groupId> ????????????<artifactId>jstl</artifactId> ????????????<version>1.2</version> ????????????<scope>provided</scope> ????????</dependency> ????????<dependency> ????????????<groupId>taglibs</groupId> ????????????<artifactId>standard</artifactId> ????????????<version>1.1.2</version> ????????????<scope>provided</scope> ????????</dependency>
3.配置Maven打包Webml目录(写在pom.xml中的build标签中,把plugins折叠起来写在后面)
<resources> ????????????<resource> ????????????????<directory>src/main/web</directory> ????????????????<targetPath>META-INF/resources</targetPath> ????????????????<includes> ????????????????????<include>**/*.*</include> ????????????????</includes> ????????????</resource> ????????</resources>
更新
<resources> ????????????<resource> ????????????????<directory>src/main/web</directory> ????????????????<targetPath>META-INF/resources</targetPath> ????????????????<includes> ????????????????????<include>**/*.*</include> ????????????????</includes> ????????????</resource> ????????????<resource> ????????????????<directory>src/main/resources</directory> ????????????????<includes> ????????????????????<include>**/*.xml</include> ????????????????????<include>**/*.properties</include> ????????????????</includes> ????????????</resource> ????????</resources>
4.配置JSP文件的前缀和后缀(写在resources/application.properties配置文件中)
|