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

Reply via email to