“空转换器”的转换错误设置值-为什么我需要JSF中的转换器?
Warehouse
<h:selectOneMenu value="#{bean.selectedWarehouse}">
<f:selectItem itemLabel="Choose one .." itemValue="#{null}" />
<f:selectItems value="#{bean.availableWarehouses}" /></h:selectOneMenu>@Named@ViewScopedpublic class Bean {
private Warehouse selectedWarehouse;
private List<SelectItem> availableWarehouses;
// ...
@PostConstruct
public void init() {
// ...
availableWarehouses = new ArrayList<>();
for (Warehouse warehouse : warehouseService.listAll()) {
availableWarehouses.add(new SelectItem(warehouse, warehouse.getName()));
}
}
// ...}WarehouseSelectItem.
转换错误设置值‘com.example.Warehouse@caebabe’空转换器‘。
WarehouseSelectItemSelectItemConverter
Converter<h:selectOneMenu>
Converter
getAsString()
SelectItem
getAsObject()
SelectItem
getAsObject()
慕码人8056858
随时随地看视频慕课网APP
相关分类