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

Alexander Kolesnikov

"Tapestry 5: Building Web Applications"

recordError(passwordField,
messages.get("passwords-dont-match"));
}
}
We are setting the password property to null if passwords do not match so
that previously implemented logic (that hides password fields after password
was submitted) worked properly. Then we are recording an error into the form,
specifying the component in error and providing an error message. If some errors
were recorded into the form, Tapestry will always redisplay the same page, so we
don't need to bother about any navigation issues. Now, if you run the application
and enter two different values for password you should see something like this:
Chapter 6
[ 171 ]
The second place in the application where the onValidate method becomes useful
is the Start page. If you remember, in the case of failed authentication we are simply
redirecting the user to the Registration page. It would be much better to just display
an error message in this case. As we are not going to associate this error with any
component, here is the addition to the Start page class that will do the job:
@Component
private Form loginForm;
@Inject
private Messages messages;
Object onSuccess()
{
return ShowAll.class;
}
User Input Validation
[ 172 ]
void onValidate()
{
User authenticatedUser =
Security.


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