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

Alexander Kolesnikov

"Tapestry 5: Building Web Applications"

This means that whenever we request the ASO, it
will always be there, it will never be null.
By default, Application State Objects are stored in session. This means that if the
session didn't exist the first time you request an ASO, it will be created. We might
need to remember this when creating a highly scalable application.
We shall see how all this works pretty soon. For now, let's display the user
information on the Another page:

The user is ${myUser.firstName} ${myUser.lastName}


To complete preparations, we need to provide a way of changing the contents of the
ASO. To keep things simple, let's just reuse the existing TextField. Currently we are
using it to enter an arbitrary message, but let's add some code to accept a new user
name entered into it. This additional code will go into the onFormSubmit method.
Please make the changes shown here:
@OnEvent(value="submit", component="userInputForm")
Object onFormSubmit()
{
System.out.println("Handling form submission!");
String[] words = message.split(" ");
if (words.length > 0)
{
user.setFirstName(words[0]);
if (words.length > 1)
{
user.setLastName(words[1]);
}
}
another.setPassedMessage(message);
return another;
}
In this code, we are simply splitting the submitted message into words, and then
using the first word as the first name and the second word as the last name.


Pages:
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6