SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 72 | Next

Alexander Kolesnikov

"Tapestry 5: Building Web Applications"

But where should this value be placed? Since the component is bound to
the message property of the page class, Tapestry will find the setMessage method of
the page class and pass to it the submitted value.
Chapter 3
[ 57 ]
Let's now see how this works in practice. Modify the code of the Start.java class to
look like this:
import java.util.Date;
/**
* Start page of application t5first.
*/
public class Start
{
private int someValue = 12345;
private String message="initial value";
public int getSomeValue()
{
return someValue;
}
public void setSomeValue(int value)
{
this.someValue = value;
}
public Date getCurrentTime()
{
return new Date();
}
public String getMessage()
{
return message;
}
public void setMessage(String message)
{
System.out.println("Setting the message: " + message);
this.message = message;
}
}
We have provided a private field to store the value submitted by the user. To make
things slightly more interesting, we gave this property an initial value, and now
we expect that the text box will display this value when the page will render. If we
didn't initialize this private field, the text box would remain empty.
We have also provided two public methods, a getter and a setter, to which the
TextField component will be bound.


Pages:
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6