would dispatch back to the current handler URL [/users/add] again. Check your ViewResolve

今天再弄spring mvc的时候,界面就是出不来啊,我表示很难受!~

刚开始是:404,结果发现是 view 放在路径不对,应该放在 resources/templates路径下

如果小伙伴也有类似的问题,给大家推荐一博客!传送门

上一个问题解决了,下一个问题又来了: 500 !

具体如下:

Circular view path [ok]: 
would dispatch back to the current handler URL [/ok] again.
Check your ViewResolver setup! 
(Hint: This may be the result of an unspecified view, due to default view name generation.)

我仔细排查:注解和代码都没有问题啊,很苦恼!

最终我发现是spring boot 的版本和 theymeleaf版本不兼容的问题!

进行如下修改:以下是spring boot的版本和thymeleaf的版本:

    <!--thymeleaf的版本-->
    <properties>
        <thymeleaf.version>3.0.11.RELEASE</thymeleaf.version>
        <thymeleaf-layout-dialect.version>2.1.1</thymeleaf-layout-dialect.version>
    </properties>
    <!--spring boot的版本-->    
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.4.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

感谢身旁美丽的师姐提供思路,所以我们有问题一定不要怕,因为我们有警察叔叔!哈哈

发布了214 篇原创文章 · 获赞 281 · 访问量 9万+

猜你喜欢

转载自blog.csdn.net/lk1822791193/article/details/89761854
今日推荐