You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by jochenfrey <jo...@jochenfrey.com> on 2012/01/06 07:30:09 UTC
Re: T5: Using the strategy pattern with components.
Is there a way to get a reference to a component (or block) by classname
(MyComponent.class), instead of the id? I tried out the approach Thiago
suggested, and it works fine. However, it requires me to keep a page with a
catalog of components around (not the end of the world, but inconvenient).
Any suggestions?
Thanks!
PS: Here's code for the approach Thiago suggested:
Container.java:
public Object getTheComponent () {
org.apache.tapestry5.runtime.Component component =
componentSource.getComponent("Catalog:component1");
return component;
}
Container.tml:
<html t:sidebarTitle="Framework Version"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" >
<t:delegate to="theComponent"/>
</html>
Catalog.tml:
<t:block>
<t:component1 t:id="component1"/>
</t:block>
--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Using-the-strategy-pattern-with-components-tp2411126p5124735.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org