網站首頁 編程語言 正文
一個Layui碰上Thymeleaf導致的一個問題
今天要做一個表格導出功能項目前端是Layui就想到它有一個組件是可以直接導出成Excel的二話不說整合完成(整合的方法網上很多)
測試例子:
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]
找了好久最后發現thymeleaf 將代碼中的二維數組,兩個中括號連著當成自己的標簽去解析了。
解決方法:
? 將兩個連著的中括號中間加一個空格就行了
#修改前:
LAY_EXCEL.exportExcel([['Hello', 'World', '!']], 'hello.xlsx', 'xlsx');
#修改后:
LAY_EXCEL.exportExcel([ ['Hello', 'World', '!'] ], 'hello.xlsx', 'xlsx');
完美解決。
剛好今天LayUI官網下線了,特此記錄一下。
原文鏈接:https://blog.csdn.net/qq_22832075/article/details/120746241
相關推薦
- 2022-06-13 安裝Docker配置阿里云鏡像加速(圖文教程)_docker
- 2022-05-08 python添加列表元素append(),extend()及?insert()_python
- 2022-02-21 小程序數據延遲時,可使用userInfoReadyCallback解決
- 2022-05-17 Springboot+Maven做啟動類與業務模塊分離的架構模式
- 2023-06-03 C++一個函數如何調用其他.cpp文件中的函數_C 語言
- 2022-09-10 python讀取文件列表并排序的實現示例_python
- 2022-12-21 Kotlin掛起函數應用介紹_Android
- 2022-12-21 Python?threading中lock的使用詳解_python
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支