亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Whitelabel 錯誤頁面而不是特定的 jsp 頁面

Whitelabel 錯誤頁面而不是特定的 jsp 頁面

Cats萌萌 2022-03-10 22:07:48
我已經看到了幾個關于這個問題的問題,但我還沒有解決這個問題:我已經檢查過它們:Springboot Whitelabel Error Page --- 我的控制器被spring找到并注冊了。Spring boot - Whitelabel 錯誤頁面--- 我的控制器帶有注釋,@Controller并且我返回與我想查看的 jsp 文件名匹配的字符串。這是我的pom.xml文件:<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">    <modelVersion>4.0.0</modelVersion>    <parent>        <groupId>org.springframework.boot</groupId>        <artifactId>spring-boot-starter-parent</artifactId>        <version>2.1.1.RELEASE</version>        <relativePath /> <!-- lookup parent from repository -->    </parent>    <groupId>com.example</groupId>    <artifactId>test</artifactId>    <version>0.0.1-SNAPSHOT</version>    <packaging>war</packaging>    <name>demo</name>    <description>Demo project for Spring Boot</description>    <properties>        <java.version>1.8</java.version>    </properties>    <dependencies>        <dependency>            <groupId>org.springframework.boot</groupId>            <artifactId>spring-boot-starter</artifactId>        </dependency>        <dependency>            <groupId>org.springframework.boot</groupId>            <artifactId>spring-boot-starter-web</artifactId>        </dependency>        <dependency>            <groupId>org.springframework.boot</groupId>            <artifactId>spring-boot-starter-test</artifactId>            <scope>test</scope>        </dependency>    </dependencies>    <build>        <plugins>            <plugin>                <groupId>org.springframework.boot</groupId>                <artifactId>spring-boot-maven-plugin</artifactId>            </plugin>        </plugins>    </build></project>這是application.properties文件:server.port=8088spring.mvc.view.prefix=/WEB-INF/views/spring.mvc.view.suffix=.jsp這是文件夾結構:
查看完整描述

1 回答

?
繁花如伊

TA貢獻2012條經驗 獲得超12個贊

您需要在您的 pom 中添加以下依賴項


    <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>

        <scope>provided</scope>

    </dependency>

它應該工作。如需更多參考,您可以按照本教程進行操作


https://github.com/spring-projects/spring-boot/tree/v2.1.1.RELEASE/spring-boot-samples/spring-boot-sample-web-jsp


查看完整回答
反對 回復 2022-03-10
  • 1 回答
  • 0 關注
  • 169 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號