-
Book Overview & Buying
-
Table Of Contents
Tapestry 5: Building Web Applications
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:
<p>Here is the value: ${someValue}</p>
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. When it comes to the ${someValue} expansion, Tapestry knows that it should find the getSomeValue method in the page class and insert whatever that...
Change the font size
Change margin width
Change background colour