av一区二区在线观看_亚洲男人的天堂网站_日韩亚洲视频_在线成人免费_欧美日韩精品免费观看视频_久草视

您的位置:首頁技術(shù)文章
文章詳情頁

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

瀏覽:123日期: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> <!--引入靜態(tài)文件--> <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> <!--引入靜態(tài)文件--> <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.根據(jù)spring官網(wǎng)說明,可打包war包,仍然可使用jar -jar xxx.war執(zhí)行。

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等其他模塊引擎。

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

標簽: Spring
相關(guān)文章:
主站蜘蛛池模板: 一区二区三区四区免费观看 | 亚洲视频三区 | 亚洲 中文 欧美 日韩 在线观看 | 欧美日韩在线一区二区三区 | 久久国内 | 黑人巨大精品欧美一区二区免费 | 午夜影院在线 | 亚洲黄色片免费观看 | 一级一片在线观看 | 日韩免费一区 | 91精品国产一区二区三区动漫 | 欧美精品一区在线 | 成人午夜免费视频 | 午夜精品久久久久久久久久久久久 | 欧美片网站免费 | 华人黄网站大全 | 91久久精品一区二区二区 | 国产激情视频网站 | 在线不卡av | 亚洲日本中文 | 国产精品国产a级 | 在线免费视频一区 | 91成人在线 | 亚洲 中文 欧美 日韩 在线观看 | 亚洲 欧美 另类 日韩 | 日韩成人在线播放 | 又黄又色 | 欧美性tv | 国产午夜精品一区二区 | 精品国产乱码久久久久久图片 | 精品av| 亚洲一区二区三区四区五区中文 | 国产精品一二三区 | 激情毛片 | 国产一级特黄视频 | 久久尤物免费一区二区三区 | 六月色婷 | 精品视频在线播放 | a中文在线视频 | 成人小视频在线观看 | 人人做人人澡人人爽欧美 |