|
From: Choy R. <ch...@ny...> - 2004-03-11 11:22:52
|
Something was posted on the user list about easy Map property support
from the web framework. I assumed it would simply be a matter of naming
the request parameters "map[key]" and the bean wrapper would handle the
rest. So I tested my assumption out with something like
MapBean tb = new MapBean();
BeanWrapper bw = new BeanWrapperImpl( tb );
bw.setPropertyValue("map[key1]","value1");
assertEquals("value1", tb.getMap().get("key1") );
well, to my surprise, it doesn't get past setPropertyValue(). It's not
terrible. But since getPropertyValue("map[key1]") works, one would
expect setPropertyValue to work also.
I looked over the BeanWrapperImpl code and hacked some changes which
I've included in a patch. All the tests in BeanWrapperTestSuite still
pass.
The patch is just a hack. BeanWrapperImpl would probably need to be
refactored a bit before adding a production quality version of this
feature.
|