On Thu, 15 Sep 2011 09:19:36 -0300, Katherine Luxton
<katherine.lux...@gamesys.co.uk> wrote:
Hi
Hi!
I have a tapestry page which contains a custom component; and I always
thought that the element name given to for the component within the TML
file was used to work out which component to render.
This is correct for the <t:xxx> syntax, not for the <yyy t:type="xxx"> one.
However, in my example below, it seems that I can give this component
any element name I like and it will still discover what the correct
Component to render is. I'm assuming this might be because the embedded
component has a t:id attribute which is declared in the java class as a
specific type of component.
You're correct. You've used the @Component annotation, so it defines the
component class to be used.
You shouldn't use both @Component and <t:xxx> at the same time, as this
will cause confusion about what (class or template) is defining what
(component type, parameters, etc).
If you really want to use @Component, it should look like this:
@Component(parameters = {"label=message:dob-label",
"value=member.securityQuestion.dob", ...})
private DateOfBirth dob;
<div t:id="dob"> (notice the element can be of any tag, but has just the
t:id attribute).
Or forget about @Component (you don't need it) and leave the template as
is. If you really need to get the DateOfBirth component instance in your
class, you should use @InjectComponent, not @Component.
This is the second different question about @Component and <t:xxx> in the
same component instance in two consecutive days. Interesting. :)
--
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