spring mvc报错template might not exist or might not be accessible...

报错如下:
org.thymeleaf.templateengine : [thymeleaf][http-nio-8080-exec-3] exception processing template “upload”: error resolving template [upload], template might not exist or might not be accessible by any of the configured template resolvers
检查了配置文件.properties中spring.thymeleaf.prefix=classpath:/templates/,没错,带有斜杠。运行依旧报错。
后浏览多个网页,https://blog.csdn.net/handsomesky/article/details/88810706,此网页给予帮助,成功解决。
方法如下:将pom.xml中build由

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

修改为

<!--在build中配置resources,来防止我们资源导出失败的问题-->
<build>
    <resources>
        <resource>
            <directory>src/main/resources</directory><!--资源文件的路径-->
            <includes>
                <!--加载模板文件-->
                <include>**/*.html</include>
                <!--加载静态文件-->
                <include>/static/</include>
                <include>**/*.*</include>
            </includes>
        </resource>
    </resources>

    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

再运行成功,顺利在网页上得到需要的@controller里.html的view视图。

更新:往邮箱发送信息依旧找不到报错

ERROR 16788 — [ main] org.thymeleaf.TemplateEngine

修改HTML文件修改为:

<html lang="zh"
xmlns:th="http://www.w3.org/1999/xhtml">
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值