Hi

AFAIK, the nested components(comB) can be accessed from the container's
ComponentResources not the component's(comA) and the nested components(comB)
are present in the container not the component(comA)... So you need to know
the nested component's id to access it which can be passed as a parameter to
the component(comA)

Try

 resources.getContainerResources().getEmbeddedComponent(nested_component_id);

regards
Taha

On Sat, Mar 19, 2011 at 7:44 AM, leon <mail....@gmail.com> wrote:

> Hi all,
> I have a requirement to implement nested components, it like this:
> <t:comA>
>   <t:comB/>
>   <t:comB/>
>   <t:comB/>
> </t:comA>
>
> I have created components, but I can't access embedded components in comA:
> public class comA {
>  @Inject
>  private ComponentResources resources;
>
>  void setupRender() {
>    ComponentModel model = resources.getComponentModel();
>    List<String> embeddedIds = model.getEmbeddedIds();
>    // The problem is that embeddedIds.size() is 0!
>  }
> }
>
> So, Is this a wrong way? I'm so confused.
> Any idea? thanks!
> --
> Best Regards
> Li Guoqiang
>

Reply via email to