午夜剧场伦理_日本一道高清_国产又黄又硬_91黄色网战_女同久久另类69精品国产_妹妹的朋友在线

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

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

瀏覽:228日期: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
相關文章:
主站蜘蛛池模板: 国产成人在线免费观看 | 亚洲一区二区久久 | 在线欧美一区 | 国产伦精品一区二区三区四区视频 | 成人在线免费视频观看 | 伊人精品影院 | 婷婷激情丁香 | 国产高清在线免费观看 | 国产日韩片 | 成人午夜高清 | 人人插人人舔 | 五月琪琪 | 涩色av| 好吊操在线| 国产午夜精品久久久久 | 免费日本黄色片 | 久草视频手机在线 | 黄网在线观看视频 | 456亚洲视频 | a级片在线观看视频 | 国产美女激情视频 | 色av影院 | 99久久婷婷国产综合精品草原 | 开心色婷婷 | 欧美日韩在线视频观看 | 一色桃子av | 欧美黄色视屏 | 黄色大片网站在线观看 | 中文字幕精品一区二区精品 | 亚洲欧美一区二区三区久久 | 日韩一二三区 | 欧美精品国产精品 | aaaa黄色片| 国产精品免费久久久 | 97精品| 免费欧美一级片 | 亚洲男人的天堂网 | 二区不卡 | 91麻豆精品视频 | 国产激情网 | 色婷五月天 |