2012-06-05 30 views
1

我正在使用seam來嘗試製作一個web應用程序,並且我試圖製作一個下拉框,顯示存儲在數據庫中的車輛並允許用戶選擇多個。它一直運行直到它試圖將其存儲在對象中。 (轉換錯誤設置值'1'爲'#{employeePort.vehicle}'。),detail =(Conversion())轉換錯誤「sourceId = createEmployee:vehicle [嚴重性=(錯誤2),摘要=爲'#{employeePort.vehicle}'錯誤設置值'1'。]]「h的轉換錯誤設置值:selectManyListBox

1和6是車輛ID,我試圖將它們存儲在我的bean中的字符串中。

這裏是我的下拉代碼:

<h:selectManyListBox id="vehicle" value="#{employeePort.vehicle}" required="false"> 
    <s:selectItems value="#{employeePort.getVehicleIdList()}" var="veh" label="#{veh} #{employeePort.getModel(veh)}"/> 
</h:selectManyListBox> 

回答

2

你從列表(value="#{employeePort.getVehicleIdList()}")選擇多個項目,並試圖將它們保存爲一個字符串(value="#{employeePort.vehicle}")。將它們設置爲列表(value="#{employeePort.vehicleList}")或創建您自己的自定義轉換器將列表轉換爲字符串。

相關問題