Thanks, guys.  Still no joy -  Here is the entire 'shootin match'...

Here is the error I get when I click on the "start guessing" link...

http://old.nabble.com/file/p28528400/Application%2BException.jpeg 


Here is the project file tree:

http://old.nabble.com/file/p28528400/Java%2B-%2Btutorial1_src_main_java_org_apache_tapestry5_tutorial_pages_Index.java%2B-%2BEclipse%2B-%2B_Users_phil.mcquitty_Documents_personal_javacode.jpg
 


Here are the 4 source files involved....


--------------------------
Index.tml

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";>
  <head>
    <title>tutorial1 Start Page</title>
  </head>
  <body>

    <h1>Hi/Lo Guess</h1>

    <p>I'm thinking of a number between one and ten ... </p>

    <p>
      <t:actionlink>Start guessing</t:actionlink>
    </p>

  </body>
</html>


------------------------
Index.java

ppackage org.apache.tapestry5.tutorial.pages;

import java.util.Random;

import org.apache.tapestry5.annotations.InjectPage;

public class Index
{
  private final Random random = new Random();

  @InjectPage
  private Guess guess;

  Object onAction()
  {
    int target = random.nextInt(10) + 1;

    return guess.initialize(target);
  }
}

---------------
Guess.tml

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";>
  <head>
    <title>Guess A Number</title>
  </head>
  <body>

    <h1>The target number is ${target}.</h1>

  </body>
</html>


-------------
Guess.java

package org.apache.tapestry5.tutorial.pages;

public class Guess {
        private int target;

        public Object initialize(int target) {
                this.target = target;

                return this;
        }

        public int getTarget() {
                return target;
        }
}


aibkwik wrote:
> 
> Two problems:
> 
> 1.  The tutorial says to create Index.java but the class it creates is
> "public class Start".  I can't even compile the tutorial.  Eclipse is
> telling me that "Start" should be declared in a separate file.  It offers
> to rename the class for me.  (It wants the class to be called "Index").
> 
> Here is the content of my Index.java file:
> 
> public class Start
> {
>   private final Random random = new Random();
> 
>   @InjectPage
>   private Guess guess;
> 
>   Object onAction()
>   {
>     int target = random.nextInt(10) + 1;
> 
>     return guess.initialize(target);
>   }
> }
> 
> As represented in the tutorial, here is the interesting line from my
> Index.tml
> 
>   <t:actionlink>Start guessing</t:actionlink>
>   
> 2.  If I let eclipse rename the class to "Index" then I can at least
> compile it.  However, when I run it I get an error when I click on the
> "Start Guessing" URL.  The error is:
> 
> 
> Request event 'action' (on component Index:actionlink) was not handled;
> you must provide a matching event handler method in the component or in
> one of its containers.
> 
> 
> Can someone tell me what I am doing wrong?
> 
> Thanks!
> 

-- 
View this message in context: 
http://old.nabble.com/Noob-problem-with-Guessing-Game-tutorial-tp28519315p28528400.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to