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 64 | Next

Alexander Kolesnikov

"Tapestry 5: Building Web Applications"


Dealing with POJO has a number of benefits, including easy testing and freedom of
class design. We only need to provide some properties to store the page's state and
some methods to contain its functionality.
Chapter 3
[ 51 ]
Returning to expansions, they provide a simple way to display the value of some
property of the page class on a page. Let's see how this works.
Using Expansions
Let's add the following fragment of code to Start.java:
private int someValue = 12345;
public int getSomeValue()
{
return someValue;
}
public void setSomeValue(int value)
{
this.someValue = value;
}
This is how properties are defined in a typical JavaBean class??”a private class
variable, and public getter and setter methods for it. We could also make this
property read-only by omitting the setter method.
Now let's add an expansion to the page template to display this property. Insert the
following fragment of code somewhere in Start.tml:

Here is the value: ${someValue}


Run the application and you will see how the page displays the recent addition:
Here is the value: 12345
What Tapestry does here is that it takes the page template and starts creating an
output from it??”an HTML page to be sent to a user's browser.


Pages:
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
druga wojna światowa Free English grammar and study guid hotel jelenia góra Russian bride counter strike 1.6