When it comes time for Tapestry to instantiate a page, it must identify the Java class to instantiate.
Tapestry pages implement the IPage interface. Because this is a large interface, you will typically extends the BasePage base class (for HTML pages).
Typically, you will identify the page class within the page's specification, using the <page-specification> element's class attribute.
In many cases, however, the page specification is optional. Alternately, the class attribute may be omitted from the page specification. Tapestry takes the following steps to find the class for a page:
admin/EditUser
will be become
admin.EditUser
.
So, if the prefix list is
org.example.pages
, then Tapestry will search for
org.example.pages.admin.EditUser
, then
admin.EditUser
(that is, in the default package).
Only if those searches fail to locate a class does Tapestry continue to the next
steps, using default page class names in the application specification and beyond.
Note:
These steps are specified in the tapestry.page.PageClassProviderChain configuration point.
For simplicity, we described the search for application pages. For pages within a library, the process is the same, but it is the library's specification which is searched for the list of packages, and later, for the default page class name.
A similar search occurs for components (again, with the express desire that the class attribute of the <component-specification> not be used).