springboot集成jsp,可以打包
来源:互联网 发布:淘宝如何加入天猫商城 编辑:程序博客网 时间:2024/05/16 22:13
1、创建MAVEN工程
2、pom.xml配置
<properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><java.version>1.8</java.version><main.basedir>${basedir}/../..</main.basedir><m2eclipse.wtp.contextRoot>/</m2eclipse.wtp.contextRoot></properties>
设置parent标签 版本必须为1.4系列,否则可能无法打包
<parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>1.4.2.RELEASE</version></parent>
设置所有依赖,可以根据需求增加
<dependencies><!-- springboot启动包 --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!-- jsp相关依赖 --><dependency><groupId>javax.servlet</groupId><artifactId>javax.servlet-api</artifactId><scope>provided</scope></dependency><dependency><groupId>javax.servlet</groupId><artifactId>jstl</artifactId></dependency><!-- tomcat支持 --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-tomcat</artifactId><scope>provided</scope></dependency><dependency><groupId>org.apache.tomcat.embed</groupId><artifactId>tomcat-embed-jasper</artifactId></dependency><!-- 单元测试 --><dependency><groupId>junit</groupId><artifactId>junit</artifactId><scope>test</scope></dependency><!-- 添加devtools依赖,用于热部署 --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-devtools</artifactId><optional>true</optional><scope>true</scope></dependency></dependencies>
build标签
<build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><configuration><!-- fork: 如果没有该配置,devtools不会起作用 --><fork>true</fork></configuration><executions><execution><goals><goal>repackage</goal></goals></execution></executions></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-war-plugin</artifactId><configuration><failOnMissingWebXml>false</failOnMissingWebXml></configuration></plugin></plugins><resources><!-- 打包时将jsp文件拷贝到META-INF目录下 --><resource><!-- 指定resources插件处理哪个目录下的资源文件 --><directory>src/main/webapp</directory><!--注意此次必须要放在此目录下才能被访问到 --><targetPath>META-INF/resources</targetPath><includes><include>**/**</include></includes></resource><resource><directory>src/main/resources</directory><includes><include>**/**</include></includes><filtering>false</filtering></resource></resources></build>
3、配置application.properties
创建application.properties文件,路径src/main/resources下
spring.mvc.view.prefix=/WEB-INF/jsp/spring.mvc.view.suffix=.jsp
4、jsp路径
创建资源路径src/main/webapp
在此资源路径下创建folder 两级目录/WEB-INF/jsp/
folder: src/main/webapp/WEB-INF/jsp/xxx.jsp
src/main/webapp/WEB-INF/xxx.jsp
阅读全文
0 0
- springboot集成jsp,可以打包
- SpringBoot集成jsp
- springboot之集成jsp(springMVC)
- 在Springboot中集成jsp
- springboot jsp项目 打包jar及发布
- springboot 使用jsp 打包后无法访问
- springboot中集成jsp,打成jar包可用jsp
- springboot基本使用笔记----添加jsp支持及打包部署
- IDEA搭建SpringBoot集成Jsp的辛酸历程
- springboot之集成mybatis mongo shiro druid redis jsp
- springboot打包
- springboot + jsp
- 13.14 SpringBoot集成JSP模板引擎:JSP页面样式乱掉
- springboot打包jar包找不到jsp文件以及在linux永久执行java -jar以及springboot的多环境配置
- springboot 集成hibernate 集成struts2
- SpringBoot打包成jar在服务器上无法访问JSP页面问题
- 详解SpringBoot集成jsp(附源码)以及遇到的坑
- SpringBoot Maven 打包JAR
- document.write和innerHtml的区别
- ORACLE 11g client 和PL/SQL的安装和配置
- 【java】SSM架构改造为dubbo分布式架构
- Heapster
- ios-内购简单介绍
- springboot集成jsp,可以打包
- 定义模型
- 如何通过include标签重用mybatis的代码段
- Lua-面向对象中函数使用时冒号(:)和点(.)的区别
- DecimalFormat的几种用法!
- hdu2262 Where is the canteen(高斯消元求期望dp)
- (八)excel,word 导入导出
- Glide-入门(一)
- c++ 学习笔记