具體關于問題:
我有兩個標簽
是作業:
<td style="color: ${mealTo.excess ? "red" : "green"}">${mealTo.dateTime}</td>
它不起作用:
<c:set var="colorText" value="${mealTo.excess ? " red" : "green"}"/>
來自 IDE 的代碼
如果在表達語言中,為什么不作業三元?
更多關于這個問題:
兩個標簽復制了運算式語言中的代碼:
<td style="color: ${mealTo.excess ? "red" : "green"}">${mealTo.dateTime}</td>
<td style="color: ${mealTo.excess ? "red" : "green"}">${mealTo.description}</td>
我希望將此代碼放置在 jstl 變數中并使用它:
<c:set var="colorText" value="${mealTo.excess ? " red" : "green"}"/>
<td style="color: ${colorText}">${mealTo.dateTime}</td>
<td style="color: ${colorText}">${mealTo.description}</td>
但是 IDE 建議使用 jstl 變數的第一個標簽不正確。
謝謝!
uj5u.com熱心網友回復:
使用單引號'red','green'希望這會有所幫助
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/427037.html
