0
我有一個這樣的枚舉:如何在百里香葉中顯示枚舉getter值?
public enum UnitTypes {
LITER("l"), KILO("kg"), PIECE("pc");
private String unitType;
UnitTypes(String type) {
this.unitType = unitType;
}
String getType() {
return unitType;
}
}
如何顯示從上視圖getType方法的單個值?
我嘗試這一點,但它不工作:
<td th:text="${stock.unit.getType()}"></td>
在 「股票」 我有場,這是該枚舉類型( 「單位」)
你有什麼是正確的(你甚至可以把'$ {stock.unit.type}'縮短它)。你得到的錯誤是什麼? – Metroids
@Metroids好吧,我已將getType()更改爲公共方法。現在,我沒有錯誤,但只是一個空白字段(使用此顯示什麼) – wegtis