Page And Component ClassesPage edited by Howard M. Lewis ShipChanges (1)
Full ContentWhat's the difference between a page and a component?There's very little difference between the two. Pages clases must be in the root-package.pages package; components must be in the Other than that, they are more equal than they are different. They may have templates or may render themselves in code (pages usually have a template, components are more likely to render only in code). The major difference is that Tapestry page templates may be stored in the web context directory, as if they were static files (they can't be accessed from the client however; a specific rule prevents access to files with the .tml extension).
How do I store my page classes in a different package?Tapestry is very rigid here; you can't. Page classes must go in root-package.pages, component classes in root-package.components, etc. Why do my instance variables have to be private?Tapestry does a large amount of transformation to your simple POJO classes as it loads them into memory. In many cases, it must locate every read or write of an instance variable and change its behavior; for example, reading a field that is a component parameter will Limiting fields to private means that Tapestry can do the necessary processing one class at a time, as needed, at runtime. More complex Why don't my informal parameters show up?Getting informal parameters to work is in two steps. First, you must make a call to the ComponentResources.renderInformalParameters() method, but just as importantly, you must tell Tapestry that you want the component to support @SupportsInformalParameters public class DBImage { @Parameter(required=true) private Image image; @Inject private ComponentResources resources; boolean beginRender(MarkupWriter writer) { writer.element("img", "src", image.toClientURL(), "class", "db-image"); resources.renderInformalParameters(writer); writer.end(); return false; } }
Change Notification Preferences
View Online
|
View Changes
|
- [CONF] Apache Tapestry > Page And Component Classes confluence
- [CONF] Apache Tapestry > Page And Component Classes confluence
- [CONF] Apache Tapestry > Page And Component Classes confluence
- [CONF] Apache Tapestry > Page And Component Classes confluence
- [CONF] Apache Tapestry > Page And Component Classes confluence
- [CONF] Apache Tapestry > Page And Component Classes confluence
- [CONF] Apache Tapestry > Page And Component Classes confluence
- [CONF] Apache Tapestry > Page And Component Classes confluence
- [CONF] Apache Tapestry > Page And Component Classes confluence
- [CONF] Apache Tapestry > Page And Component Classes confluence
- [CONF] Apache Tapestry > Page And Component Classes confluence
- [CONF] Apache Tapestry > Page And Component Classes confluence
