2013-10-23 27 views
1

實際上有幾個鏈接,描述瞭如何使用arraylist填充struts2中的選擇標記。 Drop down list in struts2。但我沒有得到它。我得到的錯誤是從arrray列表填充struts2下拉列表

tag'select',field'list',name'role':請求的列表鍵'%{oList}'不能被解析爲一個集合/數組/映射/枚舉/迭代器類型。例:人或人{名} - [未知地點]

(我的列表名稱爲oList,這已經是從數據庫動作類填寫)

列表oList =新的ArrayList();

請幫我清除我的錯誤。我試了幾次。對不起,如果我做錯了。

+0

請參閱http://stackoverflow.com/q/19335468/1700321。 –

+2

您是否在Action類中爲oList定義了getter和setter? – Aryan

+0

我想你建議我檢查一下我的case.i將我的變量改爲'List olist = new ArrayList();'。但我得到同樣的錯誤。 – Sumithlal

回答

3

當分配給struts選擇標籤時,應該爲你的列表設置setter和getters(在你的情況下爲「oList」)相應的動作類。