You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Angelo Chen <an...@yahoo.com.hk> on 2007/08/22 08:23:31 UTC

T5: trying out tutorial hi/lo game, but...

Hi,
I'm learning by trying out the hi/lo game, everytime I clicked one of the
number links, the onActionFromLink was not called, here is the template:

<t:loop source="1..10" value="guess">
    <t:actionlink t:id="guess" context="guess">${guess}</t:actionlink>
</t:loop>

it generates following:

/guess.guess/1 1 
/guess.guess/2 2 
/guess.guess/3 3 
    
the Guess.java as follow:


public class Guess {

    @Persist    
    private int _target;

    private int _guess;

    public int getGuess() {
    return _guess;
}

    public void setGuess(int _guess) {
        this._guess = _guess;
    }

    
    void setup(int target) {
        _target = target;
    }

    public int getTarget() {
        return _target;
    }


    @Persist
    private String _message;

    public String getMessage() {
        return _message;
    }

   String onActionFromLink(int guess) {
        if (guess == _target) return "GameOver";

        if (guess < _target)
            _message = String.format("%d is too low.", guess);
        else
            _message = String.format("%d is too high.", guess);

        return null;
    }
}

-- 
View this message in context: http://www.nabble.com/T5%3A-trying-out-tutorial-hi-lo-game%2C-but...-tf4309599.html#a12268676
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Antwort: T5: trying out tutorial hi/lo game, but...

Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Chris,

Now it works, thanks. however  I can't see those "too high" and "too low"
messages as in the tutorial, any fix to this?

Thanks,


Christian Koeberl wrote:
> 
> Angelo Chen <an...@yahoo.com.hk> wrote:
>> Hi,
>> I'm learning by trying out the hi/lo game, everytime I clicked one of 
> the
>> number links, the onActionFromLink was not called, here is the template:
> 
> It should be onActionFromGuess because the link's id is "guess".
> 
> -- 
> Chris 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-trying-out-tutorial-hi-lo-game%2C-but...-tf4309599.html#a12270059
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


RE: Antwort: T5: trying out tutorial hi/lo game, but...

Posted by Jason Gutt <ja...@nasasupport.com>.
For the app to work I had to change this tag 

<t:actionlink t:id="guess" context="guess">${guess}</t:actionlink>
 

the id should equal "link"

-----Original Message-----
From: Christian Koeberl [mailto:christian.koeberl@porsche.co.at] 
Sent: Wednesday, August 22, 2007 2:35 AM
To: Tapestry users
Subject: Antwort: T5: trying out tutorial hi/lo game, but...

Angelo Chen <an...@yahoo.com.hk> wrote:
> Hi,
> I'm learning by trying out the hi/lo game, everytime I clicked one of 
the
> number links, the onActionFromLink was not called, here is the template:

It should be onActionFromGuess because the link's id is "guess".

-- 
Chris 




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


Antwort: T5: trying out tutorial hi/lo game, but...

Posted by Christian Koeberl <ch...@porsche.co.at>.
Angelo Chen <an...@yahoo.com.hk> wrote:
> Hi,
> I'm learning by trying out the hi/lo game, everytime I clicked one of 
the
> number links, the onActionFromLink was not called, here is the template:

It should be onActionFromGuess because the link's id is "guess".

-- 
Chris