Summary
Definitions
Overview
Illustration 1
Illustration 2
Illustration 3
Page Template
-Page Specification
Page Class
Application Specification
The Framework - a flyby
Conclusion
Biography
Resources
|
Page Specification
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification PUBLIC
"-//Apache Software Foundation//Tapestry Specification 3.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
<page-specification class="demo.Welcome">
<property-specification name="custName" type="java.lang.String"/>
<property-specification name="dob" type="java.util.Date"/>
<component id="custName" type="TextField">
<binding name="value" expression="custName"/>
</component>
<component id="dob" type="DatePicker">
<binding name="value" expression="dob"/>
</component>
</page-specification>
Listing 9. CustInfo.page
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification PUBLIC
"-//Apache Software Foundation//Tapestry Specification 3.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
<page-specification class="demo.Welcome">
<property-specification name="custName" type="java.lang.String"/>
<property-specification name="dob" type="java.util.Date"/>
</page-specification>
Listing 10. Welcome.page
The important thing to note here is that the component class,
demo.Welcome , is shared between the two Page components. This is
perfectly legal and the framework takes care of providing a fresh
instance to each component thereby making it thread-safe. The new
appearance here is the property-specification element.
This element is used to define JavaBeans-style properties in the
component class in a declarative fashion. The framework extends the
component class (demo.Welcome ) at runtime and provides the
necessary accessors and mutators for these properties using bytecode
enhancement. The component class can access these properties via
abstract methods to define its behavior as shown in Listing 11.
|