Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as

报错信息

在我使用spring boot 项目通过thymeleaf进行页面跳转访问的时候,访问不了页面,显示如下报错

Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Thu Nov 02 19:59:17 CST 2023
There was an unexpected error (type=Not Found, status=404).

报错原因

此次错误是项目依赖版本不一致导致的,其他时候如果也有类似的报错可以看看相关依赖之间版本是否一致(特别是spring相关的版本和其他的依赖的版本)

解决办法

thymeleaf的版本不能太高,此3.0.x及以上版本无法和spring-boot的2.x.x版本对上,需要降低版本(或者用parent管控默认的版本)

报错例子

            <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-thymeleaf -->
            <!-- 版本不能太高,此3.0.x及以上版本无法和spring-boot的2.x.x版本对上,需要降低版本(或者用parent管控默认的版本) -->
<!--            <dependency>-->
<!--                <groupId>org.springframework.boot</groupId>-->
<!--                <artifactId>spring-boot-starter-thymeleaf</artifactId>-->
<!--                <version>3.1.5</version>-->
<!--            </dependency>-->
<!--            <dependency>-->
<!--                <groupId>org.springframework.boot</groupId>-->
<!--                <artifactId>spring-boot-starter-thymeleaf</artifactId>-->
<!--                <version>2.6.7</version>-->
<!--            </dependency>-->

完整的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>

    <groupId>org.example</groupId>
    <artifactId>thymeleaf-test</artifactId>
    <version>1.0-SNAPSHOT</version>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.6</version>
        <relativePath/>
    </parent>
    <dependencyManagement>
        <dependencies>
            <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-thymeleaf -->
            <!-- 版本不能太高,此3.0.x及以上版本无法和spring-boot的2.x.x版本对上,需要降低版本(或者用parent管控默认的版本) -->
<!--            <dependency>-->
<!--                <groupId>org.springframework.boot</groupId>-->
<!--                <artifactId>spring-boot-starter-thymeleaf</artifactId>-->
<!--                <version>3.1.5</version>-->
<!--            </dependency>-->
<!--            <dependency>-->
<!--                <groupId>org.springframework.boot</groupId>-->
<!--                <artifactId>spring-boot-starter-thymeleaf</artifactId>-->
<!--                <version>2.6.7</version>-->
<!--            </dependency>-->
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>


</project>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
白标错误页面是指在网络应用或网站上,当用户请求的页面无法找到或发生错误,显示的一个通用错误页面。它通常是为了增加用户体验和品牌一致性而设计的。 白标错误页面与传统的错误页面不同之处在于,它采用了品牌的设计元素和相关的信息,以使用户在遇到问题感觉更加熟悉,并提供帮助或引导用户解决问题。 白标错误页面通常包括以下几个要素: 1. 品牌标识:页面上会显示网站或应用的Logo或名称,以确保用户知道他们仍然在正确的网站上; 2. 错误信息:页面会提供简洁明了的错误信息,告诉用户发生了什么问题,例如404页面不存在或500服务器错误等; 3. 导航或搜索栏:为了帮助用户继续浏览网站或应用,页面上会提供一个导航栏或搜索框,让用户轻松找到他们想要的内容; 4. 联系信息或帮助资源:页面上会提供联系信息或者链接到常见问题解答或帮助文档,以便用户可以寻求进一步的帮助; 5. 友好的语言和设计:白标错误页面通常使用友好和亲切的语言,以及与品牌一致的设计风格,产生一种给予用户支持和关怀的感觉。 总而言之,白标错误页面是通过将品牌元素与错误信息结合,以提供更好的用户体验和支持。它帮助用户理解问题的原因,并提供帮助和解决方案,以确保用户能继续使用网站或应用。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值