2
我怎樣才能將繼承設計的下一個例子轉換成tapestry5的成分設計?繼承設計到成分設計tapestry5
ParentComponent.tml:
<container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" xmlns:p="tapestry:parameter" t:content="text/html; charset=utf-8">
this is parent component<br/>
<extension-point id="body_child"/>
</container>
ParentComponent.java:
public abstract class ParentComponent {
@Property
@Parameter(required=true)
private String param1;
@Property
@Parameter(required=true)
private String param2;
@Property
@Parameter(required=true)
private String param3;
}
C1.tml:
<t:extend xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" xmlns:p="tapestry:parameter" t:content="text/html; charset=utf-8">
<t:replace id="body_child">
body of c1 ${param1}, ${param2}, ${param3}
</t:replace>
C1.java:
public class C1 extends ParentComponent {
}
test.tml:
<t:c1 param1="1" param2="2" param3="3"/>
在此先感謝。