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

Alexander Kolesnikov

"Tapestry 5: Building Web Applications"


As you already know, this means that the event handler method should be invoked
in response to the submit event generated by the component with a specified ID.
The Form component generates a few other events too. There are three events related
to validation??”validate, success, and failure. Let's implement event handler
methods for all these events.
This is where following the naming convention for event handlers, as opposed to
using the @OnEvent annotation, will save us some effort. If Tapestry will find a method
named onSuccess() in the page class, it will understand that this is the event handler
for any success event that happens on the page. Let's modify the existing handler for
the submit event and add handlers for the other events mentioned above. Here is how
these methods should look in the Registration class:
String onSubmit()
{
System.out.println("The form was submitted!");
if (unsubscribe) subscribe = false;
return nextPage;
}
void onValidate()
{
System.out.println("In onValidate.");
}
void onSuccess()
{
System.out.println("In onSuccess.");
}
void onFailure()
{
System.out.println("In onFailure.");
}
User Input Validation
[ 168 ]
As usual, we have inserted some output statements to have a glimpse into the inner
life of Tapestry.


Pages:
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6