> I want to use a component in a page, but i don't know which to use, > I only know a String at Runtime, How can I do this.
http://tapestry.apache.org/principles.html Principle 1 – Static Structure, Dynamic Behavior You can't choose your components at runtime. Although, if you have a set of known components that you want to choose from you can put your components in <t:block> and load the block by id. <t:delegate to="namedBlock"/><!-- where namedBlock is a page property which returns the block based on your runtime value --> <t:block t:id="circle"><t:drawcircle/></t:block> <t:block t:id="square"><t:drawsquare/></t:block> <t:block t:id="triangle"><t:drawtriangle/></t:block> Josh On Wed, Jun 15, 2011 at 10:20 AM, Bo Gao <eli...@gmail.com> wrote: > I want to use a component in a page, but i don't know which to use, > I only know a String at Runtime, How can I do this. > > I add <div t:type="component1"></div>to a .tml file, "component1" is the > Component Class name. > I try to add a method getComponentName() to the java file, then i can control > which > component to use, but i failed. > > Is their another way to do this? > > Thanks. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org