亚洲精品久久久中文字幕-亚洲精品久久片久久-亚洲精品久久青草-亚洲精品久久婷婷爱久久婷婷-亚洲精品久久午夜香蕉

您的位置:首頁技術文章
文章詳情頁

Spring打包jar包時jsp頁面無法訪問問題解決

瀏覽:84日期:2023-09-05 16:37:15

spring打包jar包時jsp頁面無法訪問

問題如下

Spring打包jar包時jsp頁面無法訪問問題解決

當前pom.xml配置

<build> <resources> <!--引入配置文件--> <resource><directory>src/main/resources</directory><filtering>false</filtering> </resource> <!--引入靜態文件--> <resource><directory>src/main/webapp</directory><targetPath>META-INF/resources</targetPath><filtering>false</filtering> </resource> </resources> <plugins> <plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skipTests>true</skipTests> </configuration> </plugin> </plugins> </build>

解決辦法:

1.高版本的插件不支持jsp,給spring-boot-maven-plugin指定版本號“1.4.2.RELEASE”

<build> <resources> <!--引入配置文件--> <resource><directory>src/main/resources</directory><filtering>false</filtering> </resource> <!--引入靜態文件--> <resource><directory>src/main/webapp</directory><targetPath>META-INF/resources</targetPath><filtering>false</filtering> </resource> </resources> <plugins> <plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><version>1.4.2.RELEASE</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skipTests>true</skipTests> </configuration> </plugin> </plugins> </build>

2.根據spring官網說明,可打包war包,仍然可使用jar -jar xxx.war執行。

https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-jsp-limitations

JSP LimitationsWhen running a Spring Boot application that uses an embedded servlet container (and is packaged as an executable archive), there are some limitations in the JSP support.With Jetty and Tomcat, it should work if you use war packaging. An executable war will work when launched with java -jar, and will also be deployable to any standard container. JSPs are not supported when using an executable jar.Undertow does not support JSPs.Creating a custom error.jsp page does not override the default view for error handling. Custom error pages should be used instead.

<packaging>war</packaging>

https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-documentation

spring官方不推薦使用jsp,推薦使用thymeleaf、freemaker、velocity等其他模塊引擎。

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持好吧啦網。

標簽: Spring
相關文章:
主站蜘蛛池模板: 日韩精品一区二区三区在线观看l | 手机毛片 | 久久三级精品 | 精品视频麻豆网站 | 国产精品成人一区二区1 | 成人在线网站 | 亚洲人成在线观看一区二区 | 91香蕉视频在线观看 | 日韩一级欧美一级毛片在线 | 国产换爱交换乱理伦片 | 欧美日韩国产最新一区二区 | 国产精品美女网站在线看 | 91成人在线视频 | 国产99视频精品免费视频7 | 爱色tv| 一级a毛片| 国产精品免费在线播放 | 亚洲人成网站色7799在线观看 | 免费色视频 | 黄色三级网站 | 国产成人久久蜜一区二区 | 色综合网亚洲精品久久 | 直接看的黄色网址 | 91香蕉视频在线看 | 久久久噜噜噜www成人网 | 久久青草免费91线频观看站街 | 亚州毛片 | 亚洲黄色在线视频 | 麻豆传媒在线免费 | 高清国产一级精品毛片基地 | 我想看黄色毛片 | 一级国产黄色片 | 成人999| 在线观看网址 | 国产欧美成人免费观看视频 | 亚洲一区二区精品推荐 | 伊人色综合久久天天网蜜月 | 亚洲国产精品久久久久 | 久久综合亚洲 | 在线观看自拍 | a级免费观看|