久久福利_99r_国产日韩在线视频_直接看av的网站_中文欧美日韩_久久一

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

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

瀏覽:117日期: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
相關文章:
主站蜘蛛池模板: 亚洲国产婷婷香蕉久久久久久99 | 日韩中文字幕在线播放 | www.国产高清 | 久久成人高清 | 偷拍自拍网站 | 亚洲免费网站 | 亚洲国产成人av | 日本男人的天堂 | 蜜桃视频网站在线观看 | 男女做爰高清无遮挡免费视频 | 在线中文 | 久久高清片 | 综合网激情五月 | 中文字幕日韩欧美一区二区三区 | 欧美 日韩 国产 一区 | 亚洲精品二区 | 久久激情视频 | 国产伦精品一区二区三区四区视频 | 99re视频精品| 欧日韩不卡在线视频 | 亚洲一区视频网站 | 欧美大片一区二区 | 精品第一区 | 国产精品久久久久久中文字 | 久久9久久| 亚洲天堂久 | 久久精品无码一区二区日韩av | 日本激情视频一区二区三区 | 在线观看亚洲 | 免费在线成人网 | 久久机热| 岛国免费av | 玖玖爱视频在线 | 国产在线小视频 | 亚洲三区视频 | 久久精品二区 | 午夜精 | 成人午夜精品一区二区三区 | 一二三区视频 | 中文字幕天堂在线 | 日本免费在线视频 |