Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Invalid
-
5.0.13, 5.0.14
-
None
-
None
-
jetty 6.1.9, java 1.6, os x, linux
Description
When a page contains more than one of the same component (either multiple inclusions or inside a loop) and the component contains a zone with an actionlink that updates this zone then only the zone of the first component instance gets updated in all actionlink-clicks of all components.
It appears as if the Tapestry javascript initialization mapping parameters are incorrect:
This is what gets generated:
Tapestry.DEBUG_ENABLED = true;
Tapestry.onDOMLoaded(function() {
Tapestry.init(
);
});
It should be:
...
Tapestry.init(
);
...
Below is more detailed information including code examples:
I get the correct result after clicking on
the "update: two" hyprlink (the correct zone is updated):
update: one (hyperlink)
UPDATED two
BUT when I modify the page .tml and put the body inside a
<html><body>...</body></html> in stead of only inside a
<html>...</htm>
The following html source get generated by tapestry at the bottom of
the page and...
<!--
Tapestry.DEBUG_ENABLED = true;
Tapestry.onDOMLoaded(function() {
Tapestry.init(
);
});
// -->
...and the result is incorrect ("zone1_0" should have been updated and
not "zone1"):
UPDATED two
update: two (hyperlink)
Here is all the code:
Page code:
ZonePage.tml
<html xmlns:t = "http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<t:zonecomp>one</t:zonecomp>
<br/>
<t:zonecomp>two</t:zonecomp>
</html>
public class ZonePage {
}
Component Code:
ZoneComp.tml
<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<t:zone t:id="zone1" visible="true">
<t:delegate to="prop:activeBlock"/>
</t:zone>
<t:block t:id="beforeUpdate">
<t:actionlink t:id="update" zone="zone1">update:
<t:body/></t:actionlink>
</t:block>
<t:block t:id="afterUpdate">
<p>UPDATED <t:body/></p>
</t:block>
</t:container>
public class ZoneComp {
@Persist("session")
private boolean updated = false;
@Inject
private Block beforeUpdate;
@Inject
private Block afterUpdate;
@Component(id="zone1")
private Zone zone;
public Object onActionFromUpdate()
{ updated = true; return zone; }public Object getActiveBlock()
{ if (updated) return afterUpdate; return beforeUpdate; }}