2011-11-28 91 views
1

這是關於Spring屬性編輯器的。 我正在被實現爲B類和C 我有一個命令類文件,其中,其中我有一個春季註冊自定義屬性編輯器

class Doc{ 
List<A> list ; 
} 

列表的列表可能包含B或C中的任一個對象接口A在這種情況下,我該如何使用屬性編輯器。我寫了兩個類2的屬性編輯器,並在initBinder方法把它們註冊爲

binder.registerCustomEditor(C.class,new CPropertyEditor()); 
binder.registerCustomEditor(B.class,new BPropertyEditor()); 

,但似乎並不奏效。請幫忙。

我得到以下異常:

Request processing failed; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [com.test.A] for property list: no matching editors or conversion strategy found 

這是我的第一篇,請對不起,如果我沒有犯錯。

回答

相關問題