Search this blog for:

Thursday, July 28, 2005

Package Documentation for org.apache.commons.beanutils Package

Package Documentation for org.apache.commons.beanutils Package

Beware using the struts package.. several quirks of the system are not widely documented... Just ran into an issue on a project trying to put values into a bean backed with a map... easy enough? Except our keys used an index that we need to put values into xpath...

For example, we have stuff like this: property="value(document/s25[1]/conditiontext)"

Unfortuantely, looking at the BeanUtils setProperty code:


// Invoke the setter method
try {
if (index >= 0) {
PropertyUtils.setIndexedProperty(target, propName,
index, newValue);
} else if (key != null) {
PropertyUtils.setMappedProperty(target, propName,
key, newValue);
} else {
PropertyUtils.setProperty(target, propName, newValue);
}
} catch (NoSuchMethodException e) {
throw new InvocationTargetException
(e, "Cannot set " + propName);
}


You can clearly see that if a property has an index (which is a property with square braces in it) then it uses setIndexedProperty.

So if you want to use setMappedProperty and your property key has square braces... well you'd better think again.

Friday, July 08, 2005

a l p h a f o o b a r :: Yahoo!

a l p h a f o o b a r :: Yahoo!

Long time no speak... Google toolbar for firefox and with it blogger is mine again (IE won me back from firefox 0.7 with the google toolbar... but Firefox got me back with 0.8).