package com.packtpub.t5first.pages;
import java.util.Date;
import org.apache.tapestry.annotations.InjectPage;
import org.apache.tapestry.annotations.OnEvent;
/**
* Start page of application t5first.
*/
public class Start
{
private int someValue = 12345;
private String message="initial value";
@InjectPage
private Another another;
public int getSomeValue()
{
return someValue;
}
public void setSomeValue(int value)
{
this.someValue = value;
}
The Foundations of Tapestry
[ 62 ]
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;
}
@OnEvent(value="submit", component="userInputForm")
Object onFormSubmit()
{
System.out.println("Handling form submission!");
another.setPassedMessage(message);
return another;
}
}
What Can be Returned From an Event
Handler
There are actually a few different options of what you can return from an
event handler:
Nothing: This is when the method is void or when it returns a null
value. In this case the current page will render the request. That is, it will
be redisplayed.
Pages:
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90