日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > javascript >内容正文

javascript

Thymeleaf中使用select进行消息回显时提示:Exception evaluaating SpringEL expression

發布時間:2025/3/19 javascript 17 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Thymeleaf中使用select进行消息回显时提示:Exception evaluaating SpringEL expression 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

場景

在進行新增和編輯共用一個頁面時,選擇新增則頁面沒有refundOrder傳值,

選擇編輯擇有。

使用thymeleaf進行select的下拉選中的回顯時提示:

錯誤代碼如下:

??

<select class="form-control" name="businessInitiator" ><option? id="qingjieInitiator" th:selected="${refundOrder.businessInitiator eq '清潔車間'}"? value="清潔車間" ><span th:text="清潔車間"></span></option><option? id="zhengjiInitiator" th:selected="${refundOrder.businessInitiator eq '正極車間'}"? value="正極車間" ><span th:text="正極車間"></span></option><option? id="fujiInitiator" th:selected="${refundOrder.businessInitiator eq '負極車間'}"? value="負極車間"><span th:text="負極車間"></span></option><option? id="xuanzeInitiator"th:selected="${refundOrder==null||refundOrder.businessInitiator==null}"? value="選擇退貨發起方"><span th:text="選擇退貨發起方"></span></option></select>

實現

雖然提示是模板有問題,但是不是語法問題而是邏輯問題。

在新增頁面上refundOrder為空但是直接使用了其屬性作為條件判斷,沒有做非空判斷處理。

正確代碼:

<select class="form-control" name="businessInitiator" ><option? id="yuanliaoInitiator" th:selected="${refundOrder != null && refundOrder.businessInitiator != null && refundOrder.businessInitiator? == '原料立庫'}" value="原料立庫"><span th:text="原料立庫"></span></option><option? id="qingjieInitiator" th:selected="${refundOrder != null && refundOrder.businessInitiator != null && refundOrder.businessInitiator? == '清潔車間'}" value="清潔車間"><span th:text="清潔車間"></span></option><option? id="zhengjiInitiator" th:selected="${refundOrder != null && refundOrder.businessInitiator != null && refundOrder.businessInitiator? == '正極車間'}" value="正極車間"><span th:text="正極車間"></span></option><option? id="fujiInitiator" th:selected="${refundOrder != null && refundOrder.businessInitiator != null && refundOrder.businessInitiator? == '負極車間'}" value="負極車間"><span th:text="負極車間"></span></option><option? id="xuanzeInitiator" th:selected="${refundOrder==null||refundOrder.businessInitiator==null}"? value="選擇退貨發起方"><span th:text="選擇退貨發起方"></span></option></select>

?

總結

以上是生活随笔為你收集整理的Thymeleaf中使用select进行消息回显时提示:Exception evaluaating SpringEL expression的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。