[
https://issues.apache.org/jira/browse/TAPESTRY-2470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12606684#action_12606684
]
Kristian Marinkovic commented on TAPESTRY-2470:
-----------------------------------------------
hi fritz,
i don't think this is a bug. it is correct and expected behavior.
if you use T5 there are several ways to use and to declare components: see
http://tapestry.apache.org/tapestry5/tapestry-core/guide/templates.html
if you declare a component using the @Component annotation T5 expects
that there is a t:id attribute in the template with the name of the field (or a
explicitly
set id) or it will throw an exception.
see
http://tapestry.apache.org/tapestry5/tapestry-core/guide/component-classes.html
what you did is to declare the same component twice: first using "invisible
instrumentation"
and then using the @Component annotation without a corresponding t:id (thats
what the
error message is saying).
Furthermore, just imagine what it would be if you used your component twice in
your template
using the @Component annotation with only the type attribute. How could T5
distinguish them then?
> Wrong error message: [ERROR] Uebersicht Embedded component(s) kopf are
> defined within component class .....pages.Uebersicht, but are not present in
> the component template.
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: TAPESTRY-2470
> URL: https://issues.apache.org/jira/browse/TAPESTRY-2470
> Project: Tapestry
> Issue Type: Bug
> Components: tapestry-core
> Affects Versions: 5.0.13
> Reporter: Fritz Pröbstle
> Priority: Minor
>
> Abstract: Error message not correct
> Workaround: Specify t:id for the component
> Problem: Wrong error message confuses user
> Description:
> I have a Page Uebersicht with uses a Component "common/kopf" by specifiing
> only t:type="common/kopf" with *NO* t:id .
> ----------------------------------
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <div t:type="common/kopf"
> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"
> body_id="literal:startseite"
> >
> page is empty
> </div><!--end page -->
> -------------------------------
> In the Page-class I reference the "common/Kopf" by type , which works *BUT*
> generates the following error:
> [ERROR] Uebersicht Embedded component(s) kopf are defined within component
> class .....pages.Uebersicht, but are not present in the component template.
> ----------------
> public class Uebersicht {
>
>
> @Component ( type="common/kopf")
> private Kopf kopf;
> ...
> }
> ---------------
> The error generation is emitted by
> PageLoaderProcessor.loadTemplateForComponent ( see my comments inside the
> code below )
> ----------------
> for (String id : loadingComponentModel.getEmbeddedComponentIds())
> // getEmbeddedComponentIds returns {"kopf"}
>
> // -I expect it to return {"common/kopf" } for a
> component in the subpackage "common" of the "tapestry.app-package"
> embeddedIds.put(id, true);
> idAllocator.clear();
> for (String id : template.getComponentIds()) // getComponentIds
> returns *ONLY* ids which are explictly set by t:id- implicit id which are
> derived from t::type are missing
>
> // in this case I expect "common/kopf" inside the result
> {
> idAllocator.allocateId(id);
> embeddedIds.remove(id);
> }
> if (!embeddedIds.isEmpty())
>
> logger.error(ServicesMessages.embeddedComponentsNotInTemplate(embeddedIds.keySet(),
> componentClassName));
> -------------------
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]