SpringMVC 解决 Thymeleaf 表达式 在前端页面报错但不影响运行的红波浪

废话不多说,直接上图:

① 打开 Settings 窗口
② 选择 Editor --> Code Style
③ 找到 Inspections -->在其搜索框中搜索 “ Thymeleaf ”
④ 取消勾选 Thymeleaf 中的 “ Expression variable validation ”
最后要记得右下角 Apply 哦。
在这里插入图片描述

在使用Spring MVC和Thymeleaf的时候,除了需要添加Thymeleaf的主依赖之外,还需要添加thymeleaf-spring4依赖。如果没有添加thymeleaf-spring4依赖,可能会报错org.thymeleaf.spring4.view.ThymeleafViewResolver,表示找Thymeleaf解析器。因此,thymeleaf-spring4也是必可少的。\[1\] 对于Maven项目,可以在pom.xml文件中添加以下依赖配置: ``` <thymeleaf.version>2.1.3.RELEASE</thymeleaf.version> <dependency> <groupId>org.thymeleaf</groupId> <artifactId>thymeleaf</artifactId> <version>${thymeleaf.version}</version> </dependency> <dependency> <groupId>org.thymeleaf</groupId> <artifactId>thymeleaf-spring3</artifactId> <version>${thymeleaf.version}</version> </dependency> ``` 或者可以使用以下依赖配置: ``` <!-- thymeleaf --> <dependency> <groupId>org.thymeleaf</groupId> <artifactId>thymeleaf-spring4</artifactId> <version>3.0.11.RELEASE</version> </dependency> <dependency> <groupId>org.thymeleaf</groupId> <artifactId>thymeleaf</artifactId> <version>3.0.11.RELEASE</version> </dependency> ``` 这样就可以设置Thymeleaf解析器了。\[2\]\[3\] #### 引用[.reference_title] - *1* *3* [【springmvc thymeleafspringmvc整合thymeleaf](https://blog.csdn.net/qq_41929184/article/details/105244034)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [SpringMVC整合Thymeleaf模板](https://blog.csdn.net/hustwht/article/details/79129682)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值