網上有文章說不能通過JSTL訪問LazyDynaBean
http://hi.baidu.com/suofang/blog/item/87006763fc4e697b0c33faea.html
其實是不正確的
在LazyDynaBean 源碼中有一個 getMap,在該方法中有下面的注釋:DynaBean?源碼中有一個?getMap,在該方法中有下面的注釋:
通過 ${myDynaBean.map.fooProperty}的方式是可以訪問的.
JSTL對于map的訪問是通過 get() 方法,而對于非map的訪問則是通過 get屬性名稱() 方法進行的
http://hi.baidu.com/suofang/blog/item/87006763fc4e697b0c33faea.html
其實是不正確的
在LazyDynaBean 源碼中有一個 getMap,在該方法中有下面的注釋:DynaBean?源碼中有一個?getMap,在該方法中有下面的注釋:
/**
?????*?Return?a?Map?representation?of?this?DynaBean.
?????*?
?????*?This,?for?example,?could?be?used?in?JSTL?in?the?following?way?to?access
?????*?a?DynaBean's?
?????*?
?????*
?????*?@return?a?Map?representation?of?this?DynaBean
?????*/
????public?Map?getMap()?{
????????//?cache?the?Map
????????if?(mapDecorator?==?null)?{
????????????mapDecorator?=?new?DynaBeanMapDecorator(this);
????????}
????????return?mapDecorator;
????}
?????*?Return?a?Map?representation?of?this?DynaBean.
?????*?
?????*?This,?for?example,?could?be?used?in?JSTL?in?the?following?way?to?access
?????*?a?DynaBean's?
fooProperty
:?????*?
${myDynaBean.map.fooProperty}
?????*
?????*?@return?a?Map?representation?of?this?DynaBean
?????*/
????public?Map?getMap()?{
????????//?cache?the?Map
????????if?(mapDecorator?==?null)?{
????????????mapDecorator?=?new?DynaBeanMapDecorator(this);
????????}
????????return?mapDecorator;
????}
通過 ${myDynaBean.map.fooProperty}的方式是可以訪問的.
JSTL對于map的訪問是通過 get() 方法,而對于非map的訪問則是通過 get屬性名稱() 方法進行的