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 Class
package demo;

import java.util.Date;

import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.html.BasePage;

public abstract class Welcome extends BasePage {

    public abstract void setCustName(String custName);
    public abstract void setDob(Date dob);
    public abstract String getCustName();
    public abstract Date getDob();

    public void submit(IRequestCycle cycle) {
        if (getCustName() != null
            && !getCustName().trim().equals("")
            && getDob() != null) {

            Welcome welcome = (Welcome) cycle.getPage("Welcome");
            welcome.setCustName(getCustName());
            welcome.setDob(getDob());
            cycle.activate(welcome);
        }
    }
}
Listing 11. Welcome.java
The submit method is a listener method attached to the Page's form (see template Listing 7) that will be invoked by the framework automagically when the form is submitted. The submit method forwards the request to the Welcome Page (cycle.activate) if the user provided both the custName and dob. The listener method passes the custName and dob to the Welcome Page prior to activating it. The component class can be obtained from IRequestCycle (cycle.getPage("Welcome")) by providing the component name. cycle is the object provided by the framework that represents the current request-response cycle.
<< Previous Next >>