...
Running the application gives us our start:
However, clicking the link doesn't do anything yet, as its just a placeholder \<a\> tag, not an actual Tapestry component. Let's think about what should happen when the user clicks that link:
...
If you click the link, you'll get an error:
Tapestry is telling us that we need to provide some kind of event handler for that event. What does that look like?
...
So ... let's click the link and see what we get:
Ah! We didn't create a Guess page template. Tapestry was really expecting us to create one, so we better do so.
...
Hit the browser's back button, then click the "start guessing" link again. We're getting closer:
If you scroll down, you'll see the line of the Guess.tml template that has the error. We have a field named target, but it is private and there's no corresponding property, so Tapestry was unable to access it.
...
We are getting very close but there's one last big oddity to handle. Once you refresh the page you'll see that target is 0!
What gives? We know it was set to at least 1 ... where did the value go?
...
Go back to the Index page and click the link again. Finally, we have a target number:
That enough for us to get started. Let's build out the Guess page, and get ready to let the user make guesses. We'll show the count of guesses, and increment that count when they make them. We'll worry about high and low and actually selecting the correct value later.
...
At this point, the page is partially operational:
Our next step is to actually check the value provided by the user against the target and provide feedback: either they guessed too high, or too low, or just right. If they get it just right, we'll switch to the GameOver page.
For wrong guesses, we'll see an update such as:
And correct guesses will send us to the GameOver page:
Let's start with the Guess page; it now needs a new property to store the message to be displayed to the user, and needs a field for the injected GameOver page:
...