Take the 2-minute tour ×

I have a concrete class A that extends BaseA and implements InterfaceA. I want to loop through a list of A using either the base class or interface as the looping variable. Trying something like this:

<t:loop source="listOfA" value="propertyOfTypeBaseA">

gives me an error "Could not find a coercion from type A to BaseA". The same thing happens when I set value to a property of type InterfaceA. I can get the loop to work if I use Object as the looping variable type, but then I can't access any of the fields on the concrete class or the interface.

It seems like Tapestry should know how to coerce from an object to an interface it implements, but I also tried contributing a coercion from A to BaseA/InterfaceA and it still gave me that error, even though it actually showed the coercion in the list.

Any ideas?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

The interface will work if it is not in a package that Tapestry manages. And I now know that the 'base' package is one that Tapestry manages in addition to pages and components. I had put my base class and interface in that package thinking they would be safe from Tapestry's classloader voodoo. After moving them out, I still needed to contribute a coercion for the base class, but not for the interface.

share|improve this answer

Your Answer


