網(wǎng)站首頁 編程語言 正文
一個Layui碰上Thymeleaf導(dǎo)致的一個問題
今天要做一個表格導(dǎo)出功能項目前端是Layui就想到它有一個組件是可以直接導(dǎo)出成Excel的二話不說整合完成(整合的方法網(wǎng)上很多)
測試?yán)樱?/p>
LAY_EXCEL.exportExcel([['Hello', 'World', '!']], 'hello.xlsx', 'xlsx');
然后報錯。
前端報的錯:
后端報的錯:
2021-10-13 15:58:20.328 [TemplateEngine.java:1136] - [THYMELEAF][http-nio-9001-exec-1] Exception processing template "marketing/newSMStimetask/task_list_newsms": An error happened during template parsing (template: "class path resource [templates/marketing/newSMStimetask/task_list_newsms.html]")
org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/marketing/newSMStimetask/task_list_newsms.html]")
at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:241) ~[thymeleaf-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parseStandalone(AbstractMarkupTemplateParser.java:100) ~[thymeleaf-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:666) ~[thymeleaf-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1098) [thymeleaf-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1072) [thymeleaf-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.thymeleaf.spring5.view.ThymeleafView.renderFragment(ThymeleafView.java:354) [thymeleaf-spring5-3.0.9.RELEASE.jar:3.0.9.RELEASE]
找了好久最后發(fā)現(xiàn)thymeleaf 將代碼中的二維數(shù)組,兩個中括號連著當(dāng)成自己的標(biāo)簽去解析了。
解決方法:
? 將兩個連著的中括號中間加一個空格就行了
#修改前:
LAY_EXCEL.exportExcel([['Hello', 'World', '!']], 'hello.xlsx', 'xlsx');
#修改后:
LAY_EXCEL.exportExcel([ ['Hello', 'World', '!'] ], 'hello.xlsx', 'xlsx');
完美解決。
剛好今天LayUI官網(wǎng)下線了,特此記錄一下。
原文鏈接:https://blog.csdn.net/qq_22832075/article/details/120746241
相關(guān)推薦
- 2022-04-19 C語言位段(位域)機制結(jié)構(gòu)體的特殊實現(xiàn)及解析_C 語言
- 2022-08-20 python深入講解魔術(shù)方法_python
- 2023-04-01 c++實現(xiàn)堆排序的示例代碼_C 語言
- 2023-04-27 解讀react的onClick自動觸發(fā)等相關(guān)問題_React
- 2022-11-04 React項目中使用Redux的?react-redux_React
- 2022-11-30 golang中的defer函數(shù)理解_Golang
- 2022-08-11 Python操作數(shù)據(jù)庫之?dāng)?shù)據(jù)庫編程接口_python
- 2022-12-23 Kubernetes?權(quán)限管理認(rèn)證鑒權(quán)詳解_云其它
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡單動態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支