Looks like you missed an important section of the tutorial:

-------- excerpt -----------

We do need a basic GameOver page.

src/main/webapp/WEB-INF/GameOver.html:

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
  <head>
    <title>Game Over!</title>
  </head>
  <body>

    <h1>Game Over</h1>

    <p> You guessed the secret number!  </p>


  </body>
</html>

src/main/java/org/apache/tapestry/tutorial/pages/GameOver.java:

package org.apache.tapestry.tutorial.pages;

public class GameOver
{

}

With this in place, we can make guesses, and get feedback from the
application:
------------


/Serge


Robert A. Decker-2 wrote:
> 
> I'm teaching myself Tapestry by jumping right into version 5. I'm a  
> pretty experienced developer and so I'm not ready to give up and go  
> back to version 4, but I am having what is probably a very basic  
> problem...
> 
> I'm trying to do the Tapestry 5 tutorial and I'm on the section where  
> we count the number of guesses on Guess page page:
> http://tapestry.apache.org/tapestry5/tutorial1/hilo.html
> 
> The tutorial doesn't fully cover what should be in Guess.java
> 
> This method:
> Object onActionFromLink(int guess) {
>      _count++;
>      if (guess == _target) {
>          _gameOver.setup(_count);
>          return _gameOver;
>      }
> 
>           if (guess < _target)
>             _message = String.format("%d is too low.", guess);
>           else
>             _message = String.format("%d is too high.", guess);
> 
>           return null;
> }
> 
> GameOver is another page in the app. Not knowing exactly what I  
> should do, I have declared as a variable in Guess.java:
>       @InjectPage
>       GameOver _gameOver;
> 
> 
> However, this is leading to a NullPointerException, which kind of  
> makes sense because GameOver isn't persisted. So, I tried:
> @InjectPage @Persist
> GameOver _gameOver
> 
> But that doesn't fix the problem, and documentation I found in  
> Tapestry 4 seems to say that you can't declare multiple injection  
> tags per variable.
> 
> Does anyone have a working Tapestry 5 tutorial? Or can help me with  
> this specific problem?
> 
> I've also tried something like:
> GameOver _gameOver = new GameOver();
> _gameOver.setup(_count);
> return _gameOver;
> 
> (the WebObjects way) but that leads to an even weirder exception...
> 
> Thanks,
> Robert A. Decker
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-T5--tutorial-question-tf4487116.html#a12804208
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to