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

Alexander Kolesnikov

"Tapestry 5: Building Web Applications"

When it comes to the
${someValue} expansion, Tapestry knows that it should find the getSomeValue
method in the page class and insert whatever that method returns into the output.
Tapestry doesn't actually care whether the private field someValue exists in the page
class. It just needs an appropriate getter method. This is why the ${currentTime}
expansion works fine, although there is no private currentTime field. The
getCurrentTime method provides the value to be displayed. Let's examine this
method in its original state, how it looked after being generated by Maven:
public Date getCurrentTime()
{
return new Date();
}
The Foundations of Tapestry
[ 52 ]
The value returned by this method is of the java.util.Date type. When displayed
as it is, the returned instance is simply converted into a string, and you see that
already familiar output. The Date class also has a method, getTime, that returns
the date and time in milliseconds from 12 AM 1st of January 1970. What if we want
to display the value returned by this method? In other words, what if we want to
display a property of the page class?
Let's modify the page template to look like this:
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6