Using Forms
- To get inputs from the user, use a Form component and put some TextField components in it. When the form is rendered, each TextField will get the data from page object and display it in an HTML input field. When the form is submitted, each TextField will store the input into the page object and finally the Form's listener will be called so that you can perform further calculation on the data already stored in the page object.
- To tell Tapestry which page is the result page,call activate() or return the name of the page or the page object itself. Before that, you can pass information to it by calling its setter(bucket brigade pattern). To let a page load another page easily, you can inject the page in the .page file using<inject> or directly in the java class using annotations.
- In addition to TextField component, you can also use PropertySelection component and DatePicker components in a Form. A DatePicker component must be contained in a Body component so that it can put its javascript there.(NOTE:if your tapystry version is 4.1.6, you must add jwcid="@Shell" in the html tag as well)
- To create a listener object that calls your listener method on your page object, you can use the listener prefix.
- It is dangerout to use instance varivales in your page object because they're reused for different users, You should use a property by having a <property> in the .page file or by declaring an abstract getter instead. To access such properties, you can declare abstract getters and setters in your page class and make the class abstract.
- To lookup the parameters of a certain component type,use the documentation on the component.
- To see what a class does, check the API doc.