When you define a component in the Java class, using a field with the
@Component annotation, it has to "bind" to an element of the template with
the matching t:id attribute.  Your template, Index.tml, does not have an
element with t:id="menuBar".

On Sat, Nov 6, 2010 at 8:16 AM, Josh Kamau <joshnet2...@gmail.com> wrote:

> Sven
>
> Seems like i am getting somewhere.
>
> Kindly tell me, what causes this:
>
> An unexpected application exception has occurred.
>
>   - org.apache.tapestry5.ioc.internal.OperationException
>   Embedded component(s) menuBar are defined within component class
>   com.josh.tcontacts.pages.Index (or a super-class of Index), but are not
>   present in the component template
>   (classpath:com/josh/tcontacts/pages/Index.tml).
>   trace
>      - Constructing instance of page class com.josh.tcontacts.pages.Index
>      - Creating ComponentAssembler for com.josh.tcontacts.pages.Index
>   - java.lang.RuntimeException
>   Embedded component(s) menuBar are defined within component class
>   com.josh.tcontacts.pages.Index (or a super-class of Index), but are not
>   present in the component template
>   (classpath:com/josh/tcontacts/pages/Index.tml).
>
>
>
> On Sat, Nov 6, 2010 at 11:11 AM, Sven Homburg <hombu...@googlemail.com
> >wrote:
>
> > ${value} in the Menubar template should be ${item}
> >
> > with regards
> > Sven Homburg
> > Founder of the Chenille Kit Project
> > http://chenillekit.codehaus.org
> >
> >
> >
> >
> >
> > 2010/11/6 Sven Homburg <hombu...@googlemail.com>:
> > > class Menubar
> > > {
> > >  @Property
> > >  private List menuItems;
> > >
> > >  @Property
> > >  private String item;
> > >
> > >  @Component(parameters = {"source=menuItems", "value=item"})
> > >  private Loop itemLoop;
> > >
> > >  @SetupRender
> > >  void initSomeVars()
> > >  {
> > >     menuItems = new ArrayList()
> > >     menuItems.add("First Item");
> > >     menuItems.add("Second Item");
> > >  }
> > > }
> > >
> > > Menubar.tml
> > > <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";>
> > > <body>
> > > <t:content>
> > > <ul>
> > > <li t:id="itemLoop">${value}</li>
> > > </ul>
> > > <t:content>
> > > </body>
> > > </html>
> > >
> > > class Index
> > > {
> > >  @Component
> > >  private Menubar menubar
> > > }
> > >
> > > Index.tml
> > > <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";>
> > > <body>
> > > <div t:id="menubar"/>
> > > </body>
> > > </html>
> > >
> > >
> > > with regards
> > > Sven Homburg
> > > Founder of the Chenille Kit Project
> > > http://chenillekit.codehaus.org
> > >
> > >
> > >
> > >
> > >
> > > 2010/11/6 Josh Kamau <joshnet2...@gmail.com>:
> > >> Thiago,
> > >>
> > >> I am using Eclipse with maven and running it via mvn jetty:run. I am
> > fine
> > >> with restarting jetty when i make a change so i dont care much about
> > >> enabling live reloading.
> > >>
> > >> What i am doing is very simple. All i want is to have markup contained
> > in a
> > >> file e.g what is in my Menubar.tml  to be inserted into a page, e.g my
> > >> Index.tml page. I thought i would do that by creating my Menubar.tml
> and
> > >> Menubar.java as component and then adding it wherever i want in any
> page
> > by
> > >> doing something like <div t:type="menubar"/>. If someone can do this
> and
> > >> send me the files i will appreciate.
> > >>
> > >> Thanks all.
> > >>
> > >>
> > >> On Sat, Nov 6, 2010 at 10:19 AM, Thiago H. de Paula Figueiredo <
> > >> thiag...@gmail.com> wrote:
> > >>
> > >>> On Sat, 06 Nov 2010 11:30:36 -0200, Josh Kamau <
> joshnet2...@gmail.com>
> > >>> wrote:
> > >>>
> > >>>  Here is my scenario.
> > >>>>
> > >>>
> > >>> You're layout seems ok.
> > >>>
> > >>>
> > >>>  That way i never repeat any markup .  Now i wanted to achieve the
> > >>>> same with tapestry and i know its possible.
> > >>>>
> > >>>
> > >>> As far as I know, Wicket is the most similar framework to Tapestry.
> > >>>
> > >>>
> > >>>  How ever, i really need to be sure that i can split the markup into
> > >>>> various components and compose the pages as neccessary.
> > >>>>
> > >>>
> > >>> You can do that. Tapestry is meant to be easy and quick to create a
> > >>> component. You're probably stumbling into some detail (I guess it's
> > with
> > >>> your environment, not your Tapestry cod) that prevents your component
> > to
> > >>> work.
> > >>>
> > >>> What's your environment? Eclipse? m2eclipse? Jetty? Tomcat? Have you
> > >>> checked if your component template is being put in the classpath in
> the
> > same
> > >>> package/folder as your component?
> > >>>
> > >>> --
> > >>> Thiago H. de Paula Figueiredo
> > >>> Independent Java, Apache Tapestry 5 and Hibernate consultant,
> > developer,
> > >>> and instructor
> > >>> Owner, Ars Machina Tecnologia da Informação Ltda.
> > >>>
> > >>> http://www.arsmachina.com.br
> > >>>
> > >>> ---------------------------------------------------------------------
> > >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > >>> For additional commands, e-mail: users-h...@tapestry.apache.org
> > >>>
> > >>>
> > >>
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> >
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to learn
how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

Reply via email to