Hi,

Looking over your code again I just noticed something's amiss. Where's the Java code for the Layout class? You seem to have posted the InnerLayout class twice.

Anyhow, I think I've figured out what's really going on. Your using InjectContainer in Layout, but that doesn't inject the page, it injects the InnerLayout. This, of course, fails.

A potential solution would be to use ComponentResources#getPage to get your page in a getter and just use that in your layout.

-Filip

On 2008-08-18 15:30, Filip S. Adamsen wrote:
Hi,

Your BasePage should be in the base subpackage, that's test.base in your case. What happens is that Tapestry tries to cast BasePage to Component, which fails because it hasn't been enhanced by Tapestry - this only happens for components in the base, components, and page subpackages.

That's my (more or less informed) guess having checked the source of InjectContainerWorker, anyhow.

-Filip

On 2008-08-18 12:14, Richard Hoberman wrote:
Hi

I'm getting the following exception:

Component TestPage:innerlayout is not assignable to field
test.components.Layout.page (of type test.BasePage).

The skeletons for my components are below.  Essentially, my page has an
(inner) layout, which in turn has an (outer) layout.  I try to inject the
page into both (inner and outer) layouts.

The page is successfully injected into the inner layout, but the outer
fails. @InjectContainer seems to be selecting the wrong component in this case. It makes no difference if I remove the injection for the inner layout
(so it doesn't seem to be a conflict).

Should this work?

Richard Hoberman

Page template:
-----------------
<html t:type="InnerLayout" ...>

   //page contents
   </html>

Inner layout template:
--------------------------

<html t:type="Layout" ...>

   //inner layout markup including <t:body />

</html>

Layout template:
--------------------

<html  ...>

   //layout markup including <t:body />

</html>

Inner Layout class:
----------------------
public class InnerLayout extends BaseComponent {
@InjectContainer
    @Property
    private BasePage page;
//etc }

Layout class:
---------------
public class InnerLayout extends BaseComponent {
@InjectContainer
    @Property
    private BasePage page;
//etc }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to