Thank you for your responses !
I'm sorry my problem is not properly explained, I wan to generate unique ids
when I have nested components for example:
Test.tml
<t:component1/>
Component1.java:
public class Component1 {
@Inject
private ComponentResources resources;
@Inject
private org.slf4j.Logger log;
void setupRender() {
log.debug("COMPONENT1.ID={}", resources.getId());
}
}
Component1.tml:
<div xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
xmlns:p="tapestry:parameter" t:content="text/html; charset=utf-8">
<t:component2/>
</div>
Component2.java:
public class Component2 {
@Inject
private ComponentResources resources;
@Inject
private org.slf4j.Logger log;
void setupRender() {
log.debug("COMPONENT2.ID={}", resources.getId());
}
}
Component2.tml
<div xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
xmlns:p="tapestry:parameter" t:content="text/html; charset=utf-8">
</div>
Output:
24-05-2012 15:36:42 [DEBUG] Component1 - COMPONENT1.ID=component1
24-05-2012 15:36:42 [DEBUG] Component2 - COMPONENT2.ID=component2
24-05-2012 15:36:42 [DEBUG] Component1 - COMPONENT1.ID=component1_0
24-05-2012 15:36:42 [DEBUG] Component2 - COMPONENT2.ID=component2
24-05-2012 15:36:42 [DEBUG] Component1 - COMPONENT1.ID=component1_1
24-05-2012 15:36:42 [DEBUG] Component2 - COMPONENT2.ID=component2
As you note, component2's id isn't unique, How can I generate unique ids for
component2?
Thanks in advance
--
View this message in context:
http://tapestry.1045711.n5.nabble.com/How-can-I-create-a-component-that-generates-unique-ids-tp5713377p5713390.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]