The center of this application is an object that represents game, an object of class HangmanGame. This object is used to track the word being guessed, the letters that have been used, the number of misses and the letters that have been correctly guessed.
This object is a property of the visit object. What's the visit object? The visit object is a holder of all information about a single client's visit to your web application. It contains data and methods that are needed by the pages and components of your application.
The visit object is owned and created by the engine object. It is serialized and de-serialized with the engine.
The application specification includes a little extra segment at the bottom to specify the class of the visit object.
Figure 5.5. Hangman.application
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE application PUBLIC "-//Howard Lewis Ship//Tapestry Specification 1.3//EN" "http://tapestry.sf.net/dtd/Tapestry_1_3.dtd"> <application name="Tapestry Hangman" engine-class="org.apache.tapestry.engine.SimpleEngine"> <property name="org.apache.tapestry.visit-class">tutorial.hangman.Visit</property> |
So, returning from that distraction, the game object is a property of the visit object, which is accessible from any page (via the page's visit property).